Chapter 3 AXIS 207W Network Camera
Total Page:16
File Type:pdf, Size:1020Kb
Master of Science Thesis Department of Computer Science Lund Institute of Technology Implementing the PalCom protocol in an Axis network camera Brice Jaglin <[email protected]> Boel Mattsson <[email protected]> January 2007 Master of Science in Computer Science Engineering Supervisors: David Svensson, Lund Institute of Technology Daniel Elvin, Axis Communications, Lund Examiner: Boris Magnusson, Lund Institute of Technology Abstract The thesis goal was to implement the PalCom protocol in a network camera, in order to offer the camera’s existing features via the PalCom architecture. A pro- totype has been successfully developed in C, showing that it is possible to port the PalCom communication model into an embedded device. PalCom is a research project with the goal to integrate computation in our day- to-day life. It aims at improving the user experience by easing communication between electronic devices. A way to achieve this is to develop a flexible archi- tecture that can facilitate interaction and communication between independent systems. A communication model is being designed within the PalCom project, and several PalCom-compliant emulated devices have already been developed within a Java implementation. The AXIS 207W network camera is a commercial product used mainly for video surveillance. Thanks to its fully-documented API and its Linux embedded sys- tem, it is an open system, very suitable for developers to extend. Keywords: PalCom, Palpable Computing, Axis, Implementation, C, Server. Acknowledgements First of all, we would like to thank the people involved in the PalCom project at LTH, Boris Magnusson and David Svensson for introducing us to the PalCom project and listening to our suggestions. Sven Gestegård Robertz answered our questions about thread design. We also wish to thank Axis Communications for lending the 207W network cam- era. Our supervisor at Axis, Daniel Elvin, introduced us to the workings of the camera and finally solved the mysterious four fragment problem. A special thank goes to Kristina Sten who though not appointed as supervisor answered our questions well and helped us forward when we were stuck. ii Contents 1 Introduction 1 1.1 Intended readers . 1 1.2 Internet resources . 2 1.3 Report outline . 2 2 PalCom 3 2.1 Overview . 3 2.1.1 A Scenario - major traffic accident . 4 2.1.2 Possible use of Axis camera in major traffic accident . 5 2.2 PalCom architecture . 5 2.2.1 Devices . 6 2.2.2 Discovery . 7 2.2.3 Services . 7 2.2.4 Connections . 8 2.2.5 Information exchanged . 9 2.2.6 The x-palcom-control MIME type . 9 2.2.7 Assemblies . 9 2.3 Communication model . 10 2.3.1 Network . 10 2.3.2 Message format . 11 3 AXIS 207W Network Camera 15 3.1 Overview . 15 3.2 Features . 15 3.2.1 Network camera . 15 3.2.2 Image features . 16 3.2.3 Web server user interface . 16 3.2.4 Triggers and services . 17 3.3 Technical aspects . 17 3.3.1 Hardware . 17 3.3.2 Software . 18 3.3.3 API . 18 4 A PalCom server prototype on the AXIS 207W 21 4.1 Services . 21 4.1.1 PingService . 22 4.1.2 PictureService . 23 4.1.3 TimeService . 24 4.1.4 MJpegService . 25 i Contents 4.1.5 TriggerService . 26 4.2 PalCom implementation . 27 4.2.1 Discovery . 27 4.2.2 Selectors . 27 4.2.3 Connections . 28 4.2.4 Timeouts . 28 4.3 Module architecture . 28 4.3.1 PalCom base modules . 28 4.3.2 Services modules . 32 4.3.3 VAPIX module . 33 4.4 Thread architecture . 33 4.4.1 Inter-process communication . 33 5 Development 35 5.1 Testing . 35 5.1.1 Debugging . 36 5.1.2 Valgrind . 36 5.2 Design choices . 36 5.2.1 Camera-specific features . 36 5.2.2 Video features . 37 5.3 Impact of the prototype development on the PalCom protocol . 38 5.3.1 Improvements . 38 5.3.2 Open issues . 39 5.4 Evaluation . 41 5.4.1 Developing a server for an AXIS Camera . 41 5.4.2 PalCom in a small device . 41 6 Conclusions 43 6.0.3 Evaluation of the prototype . 43 6.0.4 Comparison with the built-in HTTP server . 43 6.1 Future work . 44 6.1.1 Maintaining the prototype . 44 6.1.2 Alternative implementation based on PalVM . 44 6.1.3 Reusing the prototype’s PalCom modules . 44 6.1.4 Develop an MPEG4 service . 44 A User Manual 45 A.1 AXIS 207W Quick Guide . 45 A.1.1 Hardware Overview . 45 A.1.2 Network . 46 A.1.3 HTTP server and root password . 47 A.2 Install the PalCom server . 47 A.2.1 Requirements . 47 A.2.2 Step by step . 47 A.3 Using the services . 48 A.3.1 Ping Service . 48 A.3.2 Time Service . 49 A.3.3 Picture Service . 49 A.3.4 MJPEG Service . 52 A.3.5 Trigger Service . 53 A.4 Known limitations . 55 ii Contents B How to reuse our code for another PalCom server 57 B.1 Active and passive services . 57 B.1.1 Passive services . 57 B.1.2 Active services . 57 B.2 Check-list . 58 C How to develop on the camera and tools needed 59 C.1 Build the ARM cross compiler on your host . 59 C.2 Cross compilation . 59 C.3 Transfer a file to the camera . 60 C.4 Telnet . 60 D Tools used 61 D.1 Libraries used . 61 D.1.1 XML-parser: Expat . 61 D.1.2 Pthreads . 61 D.2 Software used . 62 D.2.1 Eclipse SDK . 62 D.2.2 Doxygen . 63 iii Chapter 1 Introduction The aim of this project is to see if it is possible to implement the PalCom protocol in a small device. From a PalCom perspective, this project was about showing if it is possible to port the PalCom communication model into an embedded de- vice. From another perspective, this project is about implementing an alternative way to set up and control the Axis camera as opposed to using the built-in web interface. PalCom is an ongoing European research project aiming at integrating computa- tion in our day-to-day life. This is achieved by developing a flexible architecture for interaction and communication between electronic devices. What makes Pal- Com special is that it focuses on unplanned connections. The protocol is designed so that devices not previously thought of to have a need to communicate should be able to do so when the need arises. A number of emulated devices have al- ready been developed and implemented in Java. The AXIS 207W network camera is developed by Axis Communications in Lund and is mainly used for surveillance. It is an open system with publicly docu- mented API, and has Linux as operating system. It is thus very suitable for non Axis people to develop and extend. 1.1 Intended readers The report is intended to have several categories of readers. This section describes what you should read depending on your background and/or your motivation. Computer Scientist, Student You have a Master of Computer Science or equiv- alent, and you are interested in new perspectives to facilitate connections between devices, and the way it could be implemented. You should read chapters 2, 3, 4, and 6. You can also be interested in Chapter 5 and Appendix D if you want to know more about the development. PalCom User You have already used other PalCom devices and want to use an AXIS 207W camera with them. You should read Appendix A. Chapter 3 is also relevant if you want to know more about the camera. 1 Chapter 1. Introduction AXIS 207W User You are familiar with the AXIS 207W network camera, and you want to explore the possibilities offered by the PalCom server. Start by read- ing Chapter 2 and Appendix A. PalCom Developer You are familiar with the PalCom communication model and you want to understand how the C implementation works. Please read Chapter 4, 5, 6. Appendix B will be also valuable if you want to port the implementation to another device. 1.2 Internet resources You can find this report, as well as the source code and other useful information at http://www.lucas.lth.se/axis-palcom/. 1.3 Report outline The report is structured as follows: Chapter 2, PalCom gives an overview of the PalCom protocol. Chapter 3, Axis 207W Network camera describes the Axis camera. Chapter 4, A PalCom server prototype on.