Remote camera control
You can remotely control the camera in several ways.
- CAMAPI - JSON encoded HTTP GET and HTTP POST binding to the camera's API
- Maintenance URLs - reboot, perform a factory reset, and other maintenance functionality
- Telnet - open a console window and type most any POSIX command line command, plus maintenance commands
CAMAPI
The main way to configure and control the camera is CAMAPI - which stands for CAMera Application Programming Interface.
The network exposure of CAMAPI uses a JSON encoded HTTP GET and HTTP POST binding. There is a python library, called hcamapi.py that shows one way creating a host library which exposes the camera's API while hiding the JSON encoded HTTP GET and HTTP POST binding. The version of hcamapi.py that matches your camera's CAMAPI implementation ships in the camera. You can find it at:
The most recent online CAMAPI documentation is also available. The online documentation is derived using pydoc to process the comments in the hcamapi.py file.
In addition, the python source code file, called app.py which exposes CAMAPI for the lighttpd webserver also in available from the camera.
Maintenance URLs
To understand the two sets of maintenance URLs, it is helpful to understand the camera's software implementation. The main camera application is a python program which processes CAMAPI requests and creates the appropriate response. The lighttpd webserver accepts the HTTP GETS and HTTP POSTS and invokes the matching method in app.py. If a software defect exists in the python program, or a library used by the program, the python program may stop responding to the lighttpd webserver invocations. When this happens, all CAMAPI requests have a HTTP 500 response. If this happens, please submit a defect report via email. To allow you to recover should this occur, some maintenance URLs have a second version, which I will call the low-level URLs. These low-level URLs d not rely on python. The lighttpd webserver configuration file specifies the supported low-level URLs. You can examine the lighttpd webserver configuration file.
Python maintenance URLs
- /reboot : reboot the camera
- /factory_reset : restore camera settings to factory defaults, including network settings.
- /ext : list all user added URL software extensions
The above URLs will return a JSON encode response before taking actions
- /images/image.jpg : retrieve the most current live view image (or perhaps save view image, if enabled and the camera is saving a video).
Low-level maintenance URLs
- /reboot2 : reboot the camera
- /factory_reset2 : restore the camera's factory default configuration, including network settings
- /factory_reset_keep_ip : restore the camera's factory default configuration, except network settings. Contents of the /etc/network/interfaces file are preserved
The above URLs will be acted on immediately, not providing the expected HTTP response.
Telnet camera control
You can telnet into the camera as user root; no password required. In the telnet session, which is also often called the console, you can issue most POSIX commands. In addition, there are some camera specific commands. You can see all 319 commands that are supported by issuing the command:
ls /sbin /bin /usr/sbin /usr/bin
There are some helper command line scripts:
Command | Description |
---|---|
stop | Stop the webserver |
ws | Run the lighttpd webserver as a daemon |
app | Run the python application in the foreground without using lighttpd (uses python Flash library instead) |
reboot | Reboots the camera |
rw | Remounts the root file system as read/write. This allows you to screw up all sorts things. Be sure to reinstall a released version of the code when you are doing experimenting. |
fan | Turn the fan on or off. I use it because at times I find the camera a bit noisy when sitting on the desk next to me. |