Download user guide, user manual, owner manual and instructions guide
5 600 brands
1 870 000 user's guides
Search a brand
Advanced Search



Our partners wish to propose you the following products


Visit AXIS official site

User manual AXIS 2400 - PHP3 GUIDE

Diplodocs help download the user guide AXIS 2400 - PHP3 GUIDE.



Download the user manual AXIS 2400  
Download the complete
user guide (398 Ko)
Need help, support, reviews, tips or troubleshooting for your AXIS 2400 products ?


You may also download the following manuals related to this product:
AXIS 2400- INSTALLATION GUIDE
Preview of the first 3 pages of manual

You either have JavaScript turned off or an old version of Adobe Flash Player
Get the latest Flash Player.
User guide AXIS 2400 - PHP3 GUIDE

Detailed instructions for use are in the User's Guide.

PHP3 Guide 2400/2401/2420 PHP3 Guide 1 WHY PHP? 1.1 WHAT IS PHP 3 4 5 6 6 7 8 8 9 10 12 13 14 14 16 16 17 17 20 20 20 21 21 21 22 22 22 23 24 25 25 26 27 27 28 30 2 PHP3 AND THE VIDEO SERVER 3 PHP3 SCRIPT 3.1 LIMITATIONS 3.2 REQUIREMENTS FOR GETTING STARTED: 3.3 SCRIPTS 3.3.1 COMPLETE SCRIPT EXAMPLES 3.3.2 SCRIPT GENERATED BY THE APPLICATION WIZARD 3.3.2.1 Get the script that the wizard in the Video Server has created 3.3.3 THE TASK-SCHEDULER 3.3.3.1 Syntax 3.3.3.2 Examples 3.3.4 PUT A NEW OR CHANGED SCRIPT INSIDE THE VIDEO SERVER: 3.3.5 HOW TO ACTIVATE THE SCRIPTS? 3.3.5.1 URL 3.3.5.2 Telnet 3.3.5.2.1 To enable Telnet support 4 TROUBLESHOOTING 4.1 PHP3 SCRIPT RELATED PROBLEMS 4.2 PRODUCT RELATED PROBLEMS 5 APPENDIX A ­ INCLUDED APPLICATION 5.1 INTRODUCTION 5.2 THE SHELL - SH 5.2.1 BUILT IN COMMANDS 5.3 THE IMAGE-BUFFER - BUFFERD 5.3.1 OPTIONS 5.3.1.1 By Default 5.3.2 EXAMPLES 5.4 THE PHP-LIBS 5.4.1 ALERT.LIB 5.4.2 FTP.LIB 5.4.3 LOG.LIB 5.4.4 MAIL.LIB 5.4.5 PPP.LIB 5.4.6 EXAMPLES OF USAGE Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 1 PHP3 Guide 6 APPENDIX B - SHELL COMMANDS 6.1 7 7.1 COMMANDS APPENDIX C - PHP3 SCRIPT EXAMPLES SCRIPT EXAMPLES 32 32 35 36 Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 2 PHP3 Guide 1 Why PHP? PHP, which stands for "PHP: Hypertext Preprocessor" was chosen as the scripting language to use in some Axis Video products since: ! ! ! ! PHP is a well-known and widely used scripting language; in Feb 2001 an estimate of 23% of all Internet web servers used PHP (nearest "competing" script language was Perl with about 7%). The language syntax closely resembles Java, Perl and C, making it easy to learn for anyone with basic programming skills. Version 3, PHP3 could easily be scaled down to a smaller footprint required for embedded devices. PHP enables the creation of dynamic web pages quickly; the PHP code is simply embedded into the HTML code. At the most basic level PHP can do anything that any other scripting language or CGI program can do, such as collect html form data and generate dynamic page content. PHP is a complete scripting language with functionality such as file operations, network sockets, e-mail client (SMTP) and an FTP client. All very useful in Network Camera applications. ! The integration of event handling in Axis Video products, and a powerful scripting language such as PHP, gives knowledgeable developers endless opportunities to tailor the functionality of Axis Video products to fit their specific needs. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 3 PHP3 Guide 1.1 What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language. Simple answer, but what does that mean? An example: Example 1-1. An introductory example 1 2 3 4 Example 5 6 7 8 9 10 Notice how this is different from a CGI script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of PHP mode. What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve. A lot of information about PHP can be found on the Internet: http://www.PHP.net Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 4 PHP3 Guide 2 PHP3 and the Video Server Axis has removed some functions from the standard PHP3, and created some additional functions to suit our products. The name of Axis´ modified version of PHP3 is called PHP3-Lite. The functions among others, that are removed are those that handle: ! ! ! Database functions PDF functions Mathematic functions Axis recommends checking that PHP3-Lite supports the functions required before creating custom scripts. This can be checked by looking in the PHP3-Lite manual on our Web site: http://www.axis.com There are some applications that are shipped with the Axis 2400/2401 products; besides these applications the additional PHP3-scripts that define extra functions are explained in Appendix A at the end of this document. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 5 PHP3 Guide 3 PHP3 script Before making custom scripts Axis recommends looking at our PHP3-Lite manual (short description about this on the previous page). You can find the manual on the Axis Web site: http://www.axis.com Note: Axis Communications AB provides no guarantee that any of the examples shown here will work for a particular application. Axis Communications AB cannot and will not be held liable for any damage inflicted to any device as a result of the examples or instructions mentioned in this document. Axis Communications AB reserves the right to change this document without prior notice. !!! WARNING !!! Please keep in mind that the manufacturer of the flash chips estimates the number of writes to the flash chips to about 100,000. Writing a lot of temporary files to flash must thus be avoided. Use the ram disk mounted on /tmp instead. 3.1 Limitations For the moment it is not possible to activate more than one script at a time. So if many scripts need to be running at the same time, then delay upgrading the Video Server with Linux! Note: It´s not possible to downgrade to OSYS again, after having upgraded to Linux Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 6 PHP3 Guide 3.2 Requirements for getting started: ! ! ! Web browser FTP Client Text Editor Recommended: ! FTP Server ! SMTP Server Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 7 PHP3 Guide 3.3 Scripts Tip: A very useful program to fetch or upload a script to the product, is Ultra Edit; This can be downloaded from the following Web site: http://www.ultraedit.com/ Tip: To log all possible errors, include the row error_reporting(E_ALL); in the script. Turn off this option with the row: error_reporting(0); 3.3.1 Complete script examples It´s possible to create scripts and put them inside the video server. In Appendix C of this document are complete PHP3 scripts that can be used, which are customized for the most common applications. To run these scripts a task.list file for each script is attached (read more about task.list in section 3.3.3). Scripts for the following applications are available: ! ! ! ! A script that will upload specified images buffers via FTP and the Ethernet interface. A script that will upload specified image buffers via FTP and the Ethernet interface, and also send a mail as specified A script that will upload specified sequential images via FTP and the Ethernet interface. The uploaded images will be named according to the parameter $suffix. A script that will upload specified sequential images via FTP and the Ethernet interface. The uploaded images will be ordered in a structure defined by their date. A script that will upload specified image buffers via SMTP and the Ethernet interface. A script that will upload specified sequential images via FTP and the Ethernet interface. The uploaded images will be ordered in a structure defined by their date. Upon alarm event (indicated by an existing file named according to $alarm_file) images from the alarm buffers will be uploaded and a mail will be sent as specified by the appropriate parameters. ! ! How to upload a script to the video server and to run it is shown in section 3.3.4 and 3.3.5. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 8 PHP3 Guide 3.3.2 Script generated by the Application Wizard The wizard in the video server can generate the most basic scripts, and these can then be extended and modified to fit a particular applications needs though Axis recommends creating the scripts from scratch and putting them inside the video server. How to accomplish the above, follow the instructions on the next page. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 9 PHP3 Guide 3.3.2.1 Get the script that the wizard in the Video Server has created Start by going through the wizards in the Video Server, then open an FTP session to the Video Server. Follow the instructions below to see how this can be accomplished: Open a DOS session and type the following commands: 1. Go to the path where the script is saved Eg: c:\axis\php 2. ftp Eg: ftp 10.13.9.73 3. Type the user name Eg: user name: root 4. Type the password Eg: password: pass 5. Type: bin 6. Type: hash 7. Type: cd etc At startup, utask reads the file /etc/task.list and parses it for event entries. Therefore, it must be fetched to be able to run the script in an automatic fashion. (See also section 3.3.3 The task-Scheduler.) 8. Type: get task.list 9. Type: cd php 10. Type ls to see the file names for the files that the wizard has created: Ex: ls 11. Type: get Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 10 PHP3 Guide Note: After having created a script with the application wizard, push the remove button or restart the unit before creating a new one! (This doesn't work if it's a script that has been created from scratch, then the script has to be killed by using telnet). After following the steps on the previous page, it is possible to look at the script that the wizard in the Video Server has created (use for example Notepad to open the script). Wizard Variables Explanation $buffer_prefix = " "; $source[] = The prefix of the name of the buffer(s) started. The index or the name(s) of the buffer(s) started. The value must match the bufferd arguments. The format of the images specified to be taken according to the HTTP-API. The name to be given to the local file, excluding the extension. Number of pre alarm images to be taken. Number of post alarm images to be taken. Delay between pre images in milliseconds. Delay between post images in milliseconds. The server to upload to The body to insert into the mail. Note that this must be specified and point $image_format = " "; $file_format = " "; $pre = ; $post = ; $predelay = ; $postdelay = ; $host = "10.13.9.70"; $body = ""; Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 11 PHP3 Guide to valid file. $user = "anonymous"; $pass = "pass"; $port = "21"; $passive_mode = "no"; $time = "0"; The user to login as. The password to use for the user. The port to connect to. Choose passive mode on ("yes" or off ("no"). The time, in seconds, to stay in the script. Specifies whether to leave the FTP-function or not, after upload, ($time="0") leave the FTP function ($time="-1") continue uploading Specifies the (approximate) delay in milliseconds between image taken when $time="-1". The path to append to all uploads. This path must exist on the server prior to upload. $suffix ="default"; Do not change name of the file put on the server, i.e. overwrite the old file on server append the date to the name of the file put on the server. $suffix ="sequence"; Append a sequence number to the name of the file put on the server. $suffix ="sequence_max"; Append a sequence number to the name of the file put on the server up to a maximum number $suffix_counter = 0"; $countermax =""; Only used if $suffix ="sequence_max" Only used if suffix = "sequence"|"sequence_max" Set parameters for the image-format. Compose the command to run for imagetaking. $delay = "0"; $destination = $suffix = "date"; $startcount=""; shoot(2,30000); 3.3.3 The task-scheduler The task-scheduler is used to start programs or scripts when certain events occur. The scripts can be shell-scripts or PHP3-scripts, and can start the buffering of images or upload files by using FTP or SMTP. The task.list is the configuration file for utask which is a task-scheduler similar to cron or at. The task.list features event-detection, based on date and time, a simple socket for external events, and the ability to start any task and process management to avoid runaway childs processes. At start-up, utask reads the file /etc/task.list and parses it for event entries. If the file /etc/task.list does not exist when utask is started, then utask goes into a stand-by mode. When /etc/task.list has been created, or modified, a SIGUSR1 need to be sent Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 12 PHP3 Guide to utask in order for it to reread /etc/task.list. This can be done by issuing the system (Telnet) command 'kill -10 '. 3.3.3.1 Syntax An entry in /etc/task.list has the following syntax : %:; = is the event description = is the program to start = are the arguments to be passed to . The maximum number of events is 64. An event description should contain one or more of the following definitions. Definition [hh:mm-hh:mm] [dd/mm-dd/mm] pattern( (...) (...) ... ) once immune Meaning - Time period - Date period - External events - Start only once - Never interrupted time( h(...) m(...) s(...) ) - Time(hours,minutes,seconds) date( w(...) m(...) d(...) ) - Date(day,month,date) Time and Date values are given as a list of values (separated by a comma) and/or intervals (separated by a minus sign): Hour = 0-23 Minute = 0-59 Seconds = 0-59 Day of the week = 0-6 ('0' means Sunday) Month = 1-12 Date = 1-31. Patterns are defined as strings and follow the specific format :; Is the client application sending to utask. The Data has to be atomic i.e. if the client wants to notify two events at the same time, it has to write Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 13 PHP3 Guide :;:;. These patterns are read from /tmp/utasksocket. By default, if an event is trigged, the program runs, exits and starts again as long as the triggering event is valid. utask start at most five (5) child-processes. When the maximum number of child processes has been exceeded, utask has to decide how to proceed. utask usually kills the process with the lowest priority (if the pending task has a higher priority than this process). The entries in the configuration file (task.list) are ordered by growing priority, i.e. later entries precede earlier entries. 'once' Specifying 'once' tells utask to skip starting the program as long as the event has not been invalidated. utask checks for events ten times every second (if not in stand-by mode). Thus, if an event is specified to run at a certain point in time, say 'time(h(0) m(0) s(0) )', then this would run the program up to ten times since the event is active during a whole second. 'immune' utask also provides the user with the possibility of protecting child processes to be prematurely killed by using the 'immune' tag in the script entry. An 'immune' script will always run until it terminates. 3.3.3.2 Examples Here is an example of a task.list. The first two entries uses PHP3 to execute scripts mentioned later in this document. # FTP transfer once every 15 minutes uninterrupted. time(m(0,15,30,45)) immune once % /bin/php : ./ftp.php; # Mail the current syslog once every day. time( h(0) m(0) s(0) ) once % /bin/php : ./mail_syslog.php; # Sends and alert message every time I1 and I2 are high at the same time... pattern((IO1:H)(IO2:H)) once % alert : "Input 1 and 2 detected"; 3.3.4 Put a new or changed script inside the Video Server: If a new script is created or something has been modified in the script that the wizard has created, then the new file must be uploaded into the Video Server. To do this follow the instructions below: Note: When writing the scripts use for example Notepad. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 14 PHP3 Guide Upload a PHP3 file into the Video Server 1. Open a DOS session and open an FTP session from the path where the PHP3 file resides. Eg: c:\axis\PHP 2. Check that the file exists by typing dir Eg: c:\axis\PHP dir 3. If the file is to be executed as a link, then the file has to have the extension PHP3. If the file doesn't have this then rename the file with the DOS command ren. Eg: c:\axis\PHP ren script.doc (the old filename) script.php3 (the new filename) 4. If the file exists and has the correct filename, then open an FTP session to the Video Server: Eg: c:\axis\PHP ftp 5. Then type the user name: Eg: c:\axis\PHP user name: root 6. Then type the password: Eg: c:\axis\PHP password: pass 7. Type: Eg: c:\axis\PHP cd etc/httpd/html 8. Then upload the file to the Video Server with the command: put Eg: c:\axis\PHP put Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 15 PHP3 Guide 3.3.5 How to activate the scripts? Important! Before activating a new script, restart the video server. 3.3.5.1 URL This is the way Axis recommends to activate the scripts. To activate the new script, follow the instructions below: 1. Open the browser (Tested browsers are Netscape and Internet Explorer) 2. Type the IP-address for the Video Server in the URL: Eg: 10.13.9.75/local 3. If the file doesn't appear click the Refresh button in the browser. To activate the script select the file. (If it still doesn't happens anything look at the log file for errors) Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 16 PHP3 Guide 3.3.5.2 Telnet For development it might be useful to connect to the Network Camera by Telnet. Depending on what product is used, this is either enabled by default and have authentication or can be enabled by editing the /etc/inittab. If the product require editing of the /etc/inittab, there will be no authentication for the Telnet connection and no password will be required for access. Important: Enable this option for experimental use only. Never leave the Telnet access enabled when having the Network Camera installed on a public site. 3.3.5.2.1 To enable Telnet support Open an FTP session towards the Network Camera and type the commands viewed in bold below: C:\Axis >ftp Connected to 220 Axis 2100 Network Camera 2.12 Feb 05 2001 ready. User (:(none)): root 331 User name okay, need password. Password: pass (if not changed from default) 230 User logged in, proceed. ftp> ascii ftp> cd /etc ftp> get inittab 200 Command okay. 150 Opening data connection. 226 Transfer complete. ftp: 1380 bytes received in 0,01Seconds 138,00Kbytes/sec. At this stage, open the downloaded inittab file in an editor and find the following line: #telnetd:3:respawn:/bin/telnetd Remove the preceding "#": telnetd:3:respawn:/bin/telnetd Save the file Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 17 PHP3 Guide Go back to the ftp session and continue: ftp> put inittab 200 Command okay. 150 Opening data connection. 226 Transfer complete. ftp: 1414 bytes sent in 0,00Seconds 1414000,00Kbytes/sec. 250 Command successful. ftp> by 221 Goodbye. Restart the camera and it will be possible to access with Telnet. Activate the script through telnet To activate the script through telnet, follow the instructions below: 1. Open a telnet connection to the Video Server. 2. Type the Video Server IP-address as the Host Name: Eg: 10.13.9.73 3. Then log in with the cameras user name and password Eg: user name: root Eg: password: pass 4. Type: cd etc/httpd/html 5. check that the file exists with the command ls Eg: ls 6. Then activate the script by typing: Eg: php Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 18 PHP3 Guide Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 19 PHP3 Guide 4 Troubleshooting Tip: To log all possible errors include the following row in the script: error_reporting(E_ALL); Turn off this option with the following row: error_reporting(0); 4.1 PHP3 script related problems Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. 4.2 Product related problems If any problems occur, please try these steps first before contacting a local supplier: 1. Consult the Axis product Users Guide Appendix A - Troubleshooting. 2. Go to the AXIS product Support Web, available from www.axis.com and verify that the product contains the latest available software version. Updated trouble shooting information and the latest software for the unit can be found here. 3. Consult the FAQ and technical notes on the Axis product support page for additional help. 4. Contact the local supplier, from whom the product was purchased, for assistance. The Log file can prove a useful diagnostic tool when attempting to resolve any problems that might occur: from the Support menu, click Log File to display the latest records, events, and commands executed by the product since the last Restart of the system. Always attache the log file and parameter list when contacting Axis support. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 20 Appendix A ­ Included Application 5 Appendix A ­ Included application Note: The general rule is to not use a function when it's usage is not fully understood! 5.1 Introduction This document explains some of the applications that are shipped with the Axis 2400/2401 products. These applications are: ! ! ! sh, the shell used on the cameras (a modified sash) bufferd, a program for buffering images utask, a program for scheduling tasks (similar to cron or at). Besides these applications the additional PHP3-scripts that define extra functions are explained. The task-scheduler is used to start programs or scripts when certain events occur. The scripts can be shell-scripts or PHP3-scripts, and can start the buffering of images or upload files by using FTP or SMTP. 5.2 The shell - sh sh is a rewrite of David Bell's sash. The commands available in sh are essentially the same as the ones commonly used in other shells on any Linux/Un*x system, so the manual pages can often be of use. The difference is that the commands in sh have been simplified, i.e. options have been removed. Besides these modifications some commands have been added which are not part of the original, and thus not documented as a manual-page. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 21 Appendix A ­ Included Application 5.2.1 Built in commands The shell includes a help command, which lists the available functions built in the shell (see also Appendix B). 5.3 The image-buffer - bufferd The application bufferd captures images and stores them on the ram-disk in a FIFO-order, that is, the newest captured image overwrites the oldest. By default initd starts a bufferd as a daemon. This daemon is listening for messages on the socket /tmp/bufferdsocket. As a consequence it would not be recommended to start several daemons as this would result in one daemon overwriting what the other daemons writes. The preferred way of using bufferd is depicted in the example below. What happens when a call to bufferd is made is that the started process writes messages to the socket /tmp/bufferdsocket and then dies. Depending on which options are used when starting a buffer, bufferd starts one or two processes for handling image capturing. These processes capture a number of images according to the argument given. 5.3.1 Options The valid parameters for bufferd are: Option -start -reset -stop -d Meaning Start a buffer. Remove a buffer. Stop a buffer. Start as a daemon. This option should only be used when starting at start-up from initd or when the first instance is to be started. The name of the buffer on which the options -start, -stop and reset should act. bufferd will create a directory in /tmp named in which the images will be stored. The request-uri. Specification of the image-format as described in the HTTP-API specification (pdf-document). The protocol should be 'FTP' instead of 'http'. The document can be found on our web site -buffername -uri Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 22 Appendix A ­ Included Application (www.axis.com) under Camera & Video developer pages. -postdelay -predelay -pre -post Delay between images in milliseconds. Same as -postdelay but sets an additional variable. Number of pre-alarm pictures, i.e. number of images to save before stopping the buffer. Number of post-alarm pictures, i.e. the number of images to save after stopping the buffer. -format -snapshot -immediate Take one picture. Take one picture and stop the buffer. 5.3.1.1 By Default If the option '-buffername' is omitted, the buffer used defaults to 'buffer' ('/tmp/buffer') The protocol-specification in the request-uri should be 'FTP', instead of 'http', as this does not generate http-specific headers. The default delays (postdelay and predelay) are one(1) second (1000 milliseconds). The default number of images before and after an alarm (pre and post) is 10. The format-option specifies how the files are named. Character-expansion is supported with %y (year), %m (month), %d (date), %H (hour), %M (minute) and %S (second) corresponding to the date and time the file was created. Also supported is %i, which specifies the file-number, and can be followed by a number specifying how many digits are allowed. The default format is 'snapshot_%y%m%d_%H%M%S_%i4'. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 23 Appendix A ­ Included Application 5.3.2 Examples This example shows how to take one(1) image with camera one(1). The resulting image will be of size 640x480 and with other attributes set according to what the camera is set to. The image will be stored in /tmp/SNAP/ and named snapshot. bufferd -start -buffername SNAP -snapshot -pre 1 -format snapshot -uri ftp://axiscgi/jpg/1/fullsize.jpg The following example can be used in a PHP3-script, and is equivalent to the example above. function shoot() { $command = "bufferd -start -buffername SNAP"; $command .= " -snapshot -pre 1"; $command .= " -format snapshot"; $command .= " -uri ftp://axiscgi/jpg/1/fullsize.jpg"; system($command); } The following example creates a buffer that saves its images to the directory /tmp/ALARM/, where the files are named after the creation-time. The captured images will be half-sized (320x240) and captured every two(2) seconds by the first camera. Five(5) images before and two(2) images after the buffer is stopped, are saved. bufferd -start -buffername ALARM -uri ftp://axis-cgi/jpg/1/halfsize.jpg -pre 5 -post 2 -postdelay 2000 This example shows how to stop the buffer started above. bufferd -stop -buffername ALARM This example resets (i.e. stops buffering and clears the directory) the buffer specified in the last example. bufferd -reset -buffername ALARM Let's say a method of buffering images is required, and when an arbitrary event occurs, read alarm; the images taken will be handled and the buffering should thereafter continue. The following example illustrates the steps to take (using the examples above): Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 24 Appendix A ­ Included Application bufferd -start -buffername ALARM -uri ftp://axis-cgi/jpg/1/halfsize.jpg -pre 5 -post 2 -postdelay 2000 (This starts the buffer and can be specified in a start-up script or as an event for utask) When an event occurs, as specified for utask (see below) the following command sequence is used to handle the buffer: bufferd -stop ALARM { handle images} bufferd -reset ALARM bufferd -start -buffername ALARM -uri ftp://axis-cgi/jpg/1/halfsize.jpg -pre 5 -post 2 -postdelay 2000 The handling of the images can for instance be done with the PHP3-function 'ftp()' below (see also /usr/php/template_upload_cont.php3 on the device). 5.4 The PHP-libs Included in the distributed firmware are a few PHP3-scripts that define functions, which are intended to help developers use the camera's functionality. These scripts are located in the directory /usr/php. Currently the included files are: /usr/php/alert.lib /usr/php/ftp.lib /usr/php/log.lib /usr/php/mail.lib /usr/php/ppp.lib In order to use these functions the files need to be included in the script using them. The arguments used in the function-calls are also required to be defined/declared in the calling script. 5.4.1 alert.lib This script implements a function that connects to a host and leaves a message. This function requires an application be running on the contacted host that can handle the alert. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 25 Appendix A ­ Included Application function alert($host,$protocol,$port,$message) { ... } $host $protocol $port $message (not null) The host-name or address to send the alert to. Specify the protocol (0 = TCP, 1 = UDP). Default is '0' The port to connect to. Default is '15' the message to be sent (ASCII) The timeout for a connection-attempt is 60 seconds. On error the function returns '1' (connection failed), '2' (a parameter was missing) or '$SOCK_CONNECT_FAILED'. If the connection failed this is logged in the syslog. 5.4.2 ftp.lib This function has encapsulated the built-in PHP3-functions for FTP. function ftp($host,$user,$pass,$time,$delay,$source,$des tination,$suffix,$countermax,$startcount,$port, $passive_mode) { ... } $host $user $password $time $delay (not null) FTP Host-name (not null) User-name (not null) Password transfer period in seconds (time < 0 is infinite (i.e. never leave this function), time >= 0 is once). delay between transfers in milliseconds. (not null) Source specification. If the source file is a directory then the command tries to transfer each file in this directory. When transferring a whole directory, time and delay are ignored. (not null) Destination specification. Defines the type of stamp to be added to the filename. Valid options are: "default", "date", "sequence", $source $destination $suffix Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 26 Appendix A ­ Included Application "sequence_max". $countermax $startcount $port Defines the suffix maximum index. Only applies when $suffix = "sequence". Defines start value for the suffix index. Only applies when $suffix = ("sequence"|"sequence_max"). Port on the FTP-server to connect to. Choose passive mode. "on" or "off". $passive_mode In passive mode, data connections are initiated by the client, rather than by the server. On error, the function returns '1' (connection failed), '2' (login failed), '3' (upload failed), '4' (parameter error) or '5' (could not set passive mode). Parameter error occurs when any of $host, $user, $pass, $source or $destination is unspecified, or the parameter $suffix has an invalid value. 5.4.3 log.lib This function allows a PHP3-script to append an entry to the system log. function log($message) { ... } $message Message to be appended to the system log The function makes a call to the PHP3-function 'error_log($message,0)'. 5.4.4 mail.lib This function issues a system call to smtpclient. function mail($subject,$from,$reply,$to,$copy,$file,$att ach) { ... } Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 27 Appendix A ­ Included Application $subject $from $reply $to $copy $file $attach Message subject (default is 'no subject') (not null) Message's author Reply should be sent to this user (default is $from) (not null) Recipients Copy the message to other recipients Message read from file File to attach The script requires that a valid mail-server has been entered in the settings for the camera. Although the argument '$file' can be unspecified, this is NOT recommended as this sets smtpclient in interactive mode and thus locks the execution of PHP. On error, the function returns '1' (no sender specified) or '2' (no recipient specified) otherwise the function returns '0'. 5.4.5 ppp.lib These functions allow a PHP3-script to control the use of ppp-connections through the ppp-wrapper. function ppp_getpid() { ... } Called from ppp_start() and ppp_stop(). Returns current pppwrapper pid as reported by the file '/var/log/pppwrapper.pid'. function ppp_getstat( $num_of_checks ) { ... } Called from ppp_online(). Returns current ppp status by reading the pppstat.log. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 28 Appendix A ­ Included Application Returns '1' if it reads "ON", otherwise returns '0'. $num_of_checks is the number of attempts to read the file '/tmp/pppstat.log'. function ppp_start() { ... } Called from ppp_online(). Sends SIGUSR1 (10) to the currently running ppp-wrapper. If the wrapper isn't running the function returns '-1' and an error is logged in the syslog. function ppp_stop() { ... } Called from ppp_offline(). Sends SIGUSR2 (12) to the currently running ppp-wrapper. If the wrapper isn't running the function returns '-1'and an error is logged in the syslog. function ppp_online($behavior, $max_attempt, $ppp_interval) { ... } Initialize ppp connection. Returns '1' if connection is established, '-1' on error and logs the error in the syslog. $behavior describes the type of behavior of the ppp connection (used when closing the connection) and be either "CloseAfter" or "Optimized". $max_attempt is the number of attempts to connect before failing. $ppp_interval is the delay in seconds between connection attempts. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 29 Appendix A ­ Included Application function ppp_offline($behavior, $sec) { ... } Close ppp connection $behavior describes the type of behavior of the ppp connection and can be either "CloseAfter" or "Optimized". $sec is the time in seconds to wait before calling ppp_stop() if $behaviour="CloseAfter". If $behaviour="Optimized" no waiting is done, ppp_stop is called immediatly. 5.4.6 Examples of usage The first example depicts how to use the FTP-function in combination with the bufferd-example: The second example depicts how to use the mail-function, and is the script mentioned as mail_syslog.php in the utask-example: Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 31 Appendix B - Shell Commands 6 Appendix B - Shell Commands 6.1 Commands Options ([]=optional, <>=required) [filename ...] [dirname] Command cat cd Description Concatenate files and print on stdout Change the current directory to [dirname]. Default value of is the environment variable '$HOME' Change group identity of to Change mode of to Change owner identity to Clear IO pins. Set IO pins. Read IO pins. Copy files. If multiple are specified, must be a directory. Convert and copy Report file system disk space usage Output the Replace shell with Exit the shell. Applies to the current using the shell. Same as exit above (???) chgrp chmod chown clrbit setbit readbits cp [filename ...] [filename ...] [filename ...] [srcname ...] N/A [-neE] [arg ...] [arg ...] N/A dd df echo exec exit quit N/A Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 32 Appendix B - Shell Commands for in do Conditional execution. is the name of the variable which will be substituted by each entry in . is string of arguments separated by spaces. is the command that shall be run for each entry in the list. Conditional statement. can be any of ==, !=, >=, <=, < or > . No nested expressions or real arithmetic, but if-statements can be nested themselves. '[' and ']' cannot be used because they interfere with the wild-card expansion. End statement Display a list of built in commands Send signal to process . Default signal is SIGTERM Make links between files. When making a symbolic link (-s) only one may be specified. must be an accessible directory. List directory contents Make directories Mount a file system Default type is 'minix'. if ( ) fi help kill ln N/A N/A [-sig] [pid ...] [-s] [srcname ...] ls mkdir mount [-alidF] [filename ...] [dirname ...] [-t type] [srcname ...] N/A N/A N/A umount mv Unmount file system Move files. If multiple are specified, must be a directory. Report process status Print the absolute file name of the current working directory Reboot the system ps pwd reboot Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 33 Appendix B - Shell Commands rm rmdir setenv sethostname [filename ...] [dirname ...] Remove files Remove empty directories Change or add an environment variable Set the environment variable $HOSTNAME to Set the environment variable $DOMAINNAME to Suspend the shell for seconds Read and execute in current shell environment Same as 'source' above Set the status-led color, where is one of 'off', 'green', 'yellow' and 'red'. · green - the indicator flashes briefly and momentarily displays orange during the start-up and self-test routines; the indicator then displays green to indicate a healthy unit status. · red - the indicator will display red only if a problem with the AXIS 2400/2401 has occurred. Refer to Appendix A - Troubleshooting. setdomainname [domainname] sleep source . [sec] statusled (Available on Axis 2400) su syslog sync selectspeed touch [message ...] N/A [filename ...] Change user-id to . Send messages to the system logger Flush file system buffers Select data-rate on device Change file timestamps. If does not exist, a file is created. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.91 June 2001 34 Appendix C - PHP3 Script Examples 7 Appendix C - PHP3 Script Examples On the following pages complete PHP3 scripts can be found, which are customized for the most common applications. To run these scripts a task.list file for each script is attached. This is needed because utask reads the file /etc/task.list at startup, and parses it for event entries. Therefore, it must be fetched to be able to run the script in an automatic fashion. (See also section 3.3.3 The task-Scheduler.) The script and task.list files can be downloaded from Axis web site (www.axis.com) Note: Axis Communications AB provides no guarantee that any of the examples shown here will work for a particular application. Axis Communications AB cannot and will not be held liable for any damage inflicted to any device as a result of the examples or instructions mentioned in this document. Axis Communications AB reserves the right to change this document without prior notice. !!! WARNING !!! Please keep in mind that the manufacturer of the flash chips estimates the number of writes to the flash chips to about 100,000. Writing a lot of temporary files to flash must thus be avoided. Use the ram disk mounted on /tmp instead. Tip: To log all possible errors, include the row error_reporting(E_ALL); in the script. Turn off this option with the row: error_reporting(0); Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 35 Appendix C - PHP3 Script Examples 7.1 Script examples Important: Before using the scripts on the following pages please read chapter 1 and 2 in this document. This script will upload these specified images buffers via FTP and the Ethernet interface (alarm_ftp_net.php3) Edit your own parameters below this line. Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 38 Appendix C - PHP3 Script Examples TASK.LIST (Needed to run the script above and it's important that the file is named task.list) once immune % /bin/bufferd : -start -buffername CAM1 -pre 2 -post 2 predelay 1000 -postdelay 1000 -uri ftp://jpg/1/fullsize.jpg; date(w(0,1,2,3,4,5,6)) pattern((IO0:/)) immune once % /bin/sh : -c php /etc/httpd/html/alarm_ftp_net.php3; Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 39 Appendix C - PHP3 Script Examples This script will upload specified image buffers via FTP and the Ethernet interface, and also send a mail as specified. (alarm_ftp_note_smtp_net.php3) Edit your own parameters below this line. TASK.LIST (Needed to run the script above and it's important that the file is named task.list) once immune % /bin/bufferd : -start -buffername CAM1 -pre 2 -post 2 predelay 1000 -postdelay 1000 -uri ftp://jpg/1/fullsize.jpg; date(w(0,1,2,3,4,5,6)) pattern((IO0:/)) immune once % /bin/sh : -c php /etc/httpd/html/alarm_ftp_note_smtp_net.php3; Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 43 Appendix C - PHP3 Script Examples This script will upload these specified sequential images via FTP and the Ethernet interface. The uploaded images will be named according to the parameter $suffix. (seq_ftp_net.php3) Edit your own parameters below this line. $counter_max) { // If the loaded index exceeds //the specified maximum, reset //index $current_counter = 1; if($fd = fopen("/tmp/counter","w")) { $buf = fwrite($fd,strval($current_counter)); fclose($fd); } } error_reporting(E_ALL); $session = ftp_connect($ftp_server, $port); if($session) { // Connection successfully //established if(ftp_login($session, $user, $pass)) { // Successful login attempt if (!ftp_pasv($session, $passive_mode == "yes")) { ftp_quit($session); error_log("Could not set passive mode",0); } else { // Passive mode successfully //set $start_time = gettimeofday(); $current_time = $start_time; $session_time = 0; $inc = 0; $active_buffer = -1; $failures=0; while( ($failures<(strlen($sources)*2)) && ( ($session_time<$time)||($time==-1) )) { //Upload images as long as //not too many errors have //occurred and session time //hasn't been exceeded $loop_start = gettimeofday(); $active_buffer++; if($active_buffer==strlen($sources)) { // Loop through the indexes //specified as sources $active_buffer=0; } $source_file="/tmp/".$buffer_prefix.substr($sour ces,$active_buffer,1)."/".$file_format.".jpg"; // Build the destination name //according to the suffix //specified $dest=$destination.$buffer_prefix.substr($source s,$active_buffer,1); Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 46 Appendix C - PHP3 Script Examples if($suffix == "date") { $tinfo = getdate(time()); $dest .= "_" . conv($tinfo["year"]); $dest .= "-" . conv($tinfo["mon"]); $dest .= "-" . conv($tinfo["mday"]); $dest .= "_"; $dest .= conv($tinfo["hours"]); $dest .= conv($tinfo["minutes"]); $dest .= conv($tinfo["seconds"]); } else if($suffix == "sequence_max") { $dest .= "_" . strval($current_counter); $inc++; if($inc >= strlen($sources)) { $current_counter++; error_reporting(0); if($fd = fopen("/tmp/counter","w")) { $buf = fwrite($fd,strval($current_cou nter)); fclose($fd); } error_reporting(E_ALL); $inc = 0; } } else if($suffix == "sequence") { if($current_counter > $counter_max) { $counter = 1; } $dest .= "_" . strval($current_counter); $inc++; if($inc >= $buffer_count) { $current_counter++; error_reporting(0); if($fd = fopen("/tmp/counter","w")) { $buf = fwrite($fd,strval($current_cou nter)); fclose($fd); } error_reporting(E_ALL); $inc = 0; } } Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 47 Appendix C - PHP3 Script Examples $dest .= ".jpg"; error_reporting(0); if(is_file($source_file)) { // If the source file is a //present if(!ftp_put($session, $dest, $source_file, FTP_BINARY)) { // Upload the source file $failures++; error_log("Could not upload file ".$source_file." as ".$dest." on ".$ftp_server,0); } else { // If successful upload, //remove the uploaded file //indicating capture of a new //image $failures=0; unlink($source_file); } } else { error_reporting(E_ALL); $failures++; error_log("No such file: ".$source_file,0); } $current_time = gettimeofday(); $ellapsed = ($current_time["sec"] $loop_start["sec"]) * 1000000; if($current_time["usec"] > $loop_start["usec"]) $ellapsed += $current_time["usec"] $loop_start["usec"]; else $ellapsed -= $current_time["usec"] $loop_start["usec"]; $wait = ($delay * 1000) / strlen($sources); if($ellapsed < $wait) { // Wait if needed (in order to //follow the delay specified //and spread the traffic) usleep($wait - $ellapsed); } // Calculate session time $session_time = ($current_time["sec"] $start_time["sec"]); Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 48 Appendix C - PHP3 Script Examples else $session_time -= ($current_time["usec"] $start_time["usec"])/1000000; } if($session_time>=$time) error_log("Timed upload complete",0); if($failures>=(strlen($sources)*2)) error_log("Too many consecutive failures",0); } } else { ftp_quit($session); error_log("Could not log in as ".$user." on ".$ftp_server,0); } ftp_quit($session); } else { error_log("Could not connect to ".$ftp_server.":".$port,0); } for($c=0;$c<(strlen($sources));$c++) { // Reset buffers //$command="bufferd -stop -buffername //".$buffer_prefix.substr($sources,$c,1); //system($command); $command="bufferd -reset -buffername ".$buffer_prefix.substr($sources,$c,1); system($command); } ?> TASK.LIST (Needed to run the script above and it's important that the file is named task.list) date(w(0,1,2,3,4,5,6)) pattern((IO0:/)) immune once % /bin/sh : -c php /etc/httpd/html/seq_ftp_net.php3; Axis Communications AB does not provide support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 0.9 May 2001 49

If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Diplodocs provides you a fast and easy access to the user manual AXIS 2400.

AXIS offer a product for which we do not have the user manual? Let us know what you are looking for: user guide, owner's manual, online manual, operating instructions, quick start guide, mounting instructions, schematics, service manual, installation instructions, RTFM.

Diplodocs allows you to download user manual AXIS 2400, user guide AXIS 2400, instructions AXIS 2400, owner's manual AXIS 2400, online manual AXIS 2400.


AXIS 2400, AXIS COMMUNICATIONS, Webcam.
Include the add-on to download manuals from your site, forum or blog Frequently Asked Questions Contact Diplodocs team Last searches
Last additions
Sitemap
Brands starting with A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Copyright © 2005 - 2008 - Diplodocs - All Rights Reserved.
Designated trademarks and brands are the property of their respective owners.