Class AxisNetcam::Camera
In: lib/axis-netcam/camera.rb
Parent: Object

The AxisNetcam::Camera class represents an Axis network camera.

To control a camera, first create an instance of a Camera object and then call its methods. For example:

  require 'axis-netcam/camera'

  c = => '',
        :username => 'root', :password => 'pass')

  puts c.get_position[:tilt]
  puts c.camera_video_uri

For a list of available methods, see the RDocs for included modules:

AxisNetcam::Camera::PTZ :for point-tilt-zoom control
AxisNetcam::Camera::Users :for user management
AxisNetcam::Camera::Video :for obtaining video/image data
AxisNetcam::Camera::Info :for diagnostic/status information

Note that by default, AxisNetcam::Camera will log quite verbosely to stdout. See AxisNetcam::Camera#new for info on how to change this behaviour.


disconnect   new   to_s  

Included Modules

PTZ Users Video Info

Classes and Modules

Module AxisNetcam::Camera::Info
Module AxisNetcam::Camera::PTZ
Module AxisNetcam::Camera::Users
Module AxisNetcam::Camera::Video
Class AxisNetcam::Camera::InvalidLogin
Class AxisNetcam::Camera::RemoteError
Class AxisNetcam::Camera::RemoteTimeout


hostname  [R] 
logger  [R] 

Public Class methods

Create a new Camera object. Options must include a :hostname, :username, and :password. A Logger object can also be specified to the :logger option, otherwise logging will be done to STDOUT.


# File lib/axis-netcam/camera.rb, line 58
    def initialize(options)
      @hostname = options[:hostname] or raise(ArgumentError, "Must specify a hostname")
      @username = options[:username] or raise(ArgumentError, "Must specify a username")
      @password = options[:password] or raise(ArgumentError, "Must specify a password")
      @log = options[:logger] ||

Public Instance methods


# File lib/axis-netcam/camera.rb, line 512
    def disconnect
      if @http &&
        @log.debug "AXIS REMOTE API closing HTTP connection #{@http}"
        @http = nil
        @log.warn "AXIS REMOTE API cannot disconnect because the HTTP connection is not open"


# File lib/axis-netcam/camera.rb, line 508
    def to_s