An accessor for a Foscam camera. The commands that this accessor supports are:
- snapshot: Take a picture and produce it on the '''response''' output.
- videostream: Output a video stream.
- center: Center the camera. This will pan to find the center.
- down: Move the camera down.
- left: Move the camera left.
- right: Move the camera left.
- up: Move the camera left. For the last four motion command commands, you can specify an argument 'degree' in the arguments object to move a specified number of degrees. If no degree argument is given, the camera will move as far as it can in the specified direction, or until you give it a stop command:
- stop down
- stop left
- stop right
- stop up The following commands start and stop continual panning of the camera:
- horizontal patrol
- vertical patrol
- stop horizontal patrol
- stop vertical patrol
If you select videostream then you can specify 'resolution' and 'rate' options. FIXME: Make more user friendly versions of these. resolution = 8 specifies 320*240. rate=15 specifies 1fps. NOTE: The videostream selection appears to not actually work. It has been known to produce a frame or two, but it needs further work.
The options input can be a string URL or an object with the following fields:
- '''headers''': An object containing request headers. By default this is an empty object. Items may have a value that is an array of values, for headers with more than one value.
- '''keepAlive''': A boolean that specified whether to keep sockets around in a pool to be used by other requests in the future. This defaults to false.
- '''method''': A string specifying the HTTP request method. This defaults to 'GET', but can also be 'PUT', 'POST', 'DELETE', etc.
- '''url''': A string that can be parsed as a URL, or an object containing
the following fields:
- '''host''': A string giving the domain name or IP address of the server to issue the request to. This defaults to 'localhost'.
- '''protocol''': The protocol. This is a string that defaults to 'http'.
- '''port''': Port of remote server. This defaults to 80.
This accessor has been tested with a Foscam NVision F18910W only. The (rather poor) documentation for the camera API can be found here: http://www.foscam.es/descarga/ipcam_cgi_sdk.pdf. The design of this accessor is inspired by the "foscam" module for Node.js, found at https://github.com/fvdm/nodejs-foscam.
- Version:
- $$Id$$
- Source:
Inputs:
Name | Type | Description |
---|---|---|
options |
JSON | The specification for the URL, as defined above. |
command |
string | The command. |
arguments |
JSON | Arguments to the command. |
trigger |
An input to trigger the command. |
Outputs:
Name | Type | Description |
---|---|---|
response |
string | The server's response. |
status |
int | The status code of the response. |
headers |
JSON | The headers sent with the response. |
Extends
- net.REST
Methods
(static) encodePath()
Override the base class to construct the path for the URL from. more user-friendly descriptions of the command.
(static) setup()
Define inputs and outputs.
(static) wrapup()
Upon wrapup, attempt to stop the camera videostream.