Accessor: cameras/Foscam

cameras/Foscam

An accessor for a Foscam camera. The commands that this accessor supports are:

  1. snapshot: Take a picture and produce it on the '''response''' output.
  2. videostream: Output a video stream.
  3. center: Center the camera. This will pan to find the center.
  4. down: Move the camera down.
  5. left: Move the camera left.
  6. right: Move the camera left.
  7. 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:
  8. stop down
  9. stop left
  10. stop right
  11. stop up The following commands start and stop continual panning of the camera:
  12. horizontal patrol
  13. vertical patrol
  14. stop horizontal patrol
  15. 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:

  1. '''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.
  2. '''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.
  3. '''method''': A string specifying the HTTP request method. This defaults to 'GET', but can also be 'PUT', 'POST', 'DELETE', etc.
  4. '''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$$
Author:
  • Edward A. Lee (eal@eecs.berkeley.edu)
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.

Source:

(static) setup()

Define inputs and outputs.

Source:

(static) wrapup()

Upon wrapup, attempt to stop the camera videostream.

Source: