firewire.h

00001 
00002 /***************************************************************************
00003  *  firewire.h - This header defines a Firewire 1394 cam
00004  *
00005  *  Generated: Tue Feb 22 10:36:39 2005
00006  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_CAMS_FIREWIRE_H_
00025 #define __FIREVISION_CAMS_FIREWIRE_H_
00026 
00027 #include <cams/camera.h>
00028 #include <cams/control/focus.h>
00029 
00030 #include <dc1394/dc1394.h>
00031 
00032 #ifndef __STDC_LIMIT_MACROS
00033 #define __STDC_LIMIT_MACROS
00034 #endif
00035 #include <stdint.h>
00036 
00037 namespace firevision {
00038 #if 0 /* just to make Emacs auto-indent happy */
00039 }
00040 #endif
00041 
00042 class CameraArgumentParser;
00043 
00044 class FirewireCamera
00045 : public Camera,
00046   public CameraControlFocus
00047 {
00048 
00049  public:
00050 
00051   FirewireCamera(dc1394framerate_t framerate = DC1394_FRAMERATE_30,
00052                  dc1394video_mode_t mode     = DC1394_VIDEO_MODE_640x480_YUV422,
00053                  dc1394speed_t speed         = DC1394_ISO_SPEED_400,
00054                  int num_buffers=8);
00055   FirewireCamera(const CameraArgumentParser *cap);
00056 
00057   virtual ~FirewireCamera();
00058 
00059   virtual void open();
00060   virtual void start();
00061   virtual void stop();
00062   virtual void close();
00063   virtual void flush();
00064   virtual void capture();
00065 
00066   virtual void print_info();
00067   virtual bool ready();
00068 
00069   virtual unsigned char* buffer();
00070   virtual unsigned int   buffer_size();
00071   virtual void           dispose_buffer();
00072 
00073   virtual unsigned int   pixel_width();
00074   virtual unsigned int   pixel_height();
00075   virtual colorspace_t   colorspace();
00076 
00077   virtual void           set_image_number(unsigned int n);
00078 
00079   bool    iso_mode_enabled();
00080 
00081   virtual bool           auto_focus();
00082   virtual void           set_auto_focus(bool enabled);
00083 
00084   virtual unsigned int   focus();
00085   virtual void           set_focus(unsigned int focus);
00086   virtual unsigned int   focus_min();
00087   virtual unsigned int   focus_max();
00088 
00089   virtual bool           auto_shutter();
00090   virtual void           set_auto_shutter(bool enabled);
00091   
00092   virtual unsigned int   shutter();
00093   virtual void           set_shutter(unsigned int shutter);
00094 
00095   virtual bool           auto_white_balance();
00096   virtual void           set_auto_white_balance(bool enabled);
00097 
00098   virtual void           white_balance(unsigned int *ub, unsigned int *vr);
00099   virtual void           set_white_balance(unsigned int ub, unsigned int vr);
00100 
00101   virtual void           set_gain(unsigned int gain);
00102 
00103   virtual void           parse_set_focus(const char *focus);
00104   virtual void           parse_set_white_balance(const char *white_balance);
00105   virtual void           parse_set_shutter(const char *shutter);
00106 
00107   virtual uint64_t       guid() const;
00108   virtual const char *   model() const;
00109 
00110   static  void           print_available_fwcams();
00111 
00112  protected:
00113   /** Number of DMA buffers. */
00114   int  _num_buffers;
00115   /** true if camera has been opened, false otherwise */
00116   bool _opened;
00117   /** true if camera has been started, false otherwise */
00118   bool _started;
00119   /** true if auto focus is enabled, false if disabled */
00120   bool _auto_focus;
00121   /** true if auto shutter is enabled, false if disabled */
00122   bool _auto_shutter;
00123   /** true if auto white balance is enabled, false if disabled */
00124   bool _auto_white_balance;
00125   /** true, if a valid frame has been received, false otherwise */
00126   bool _valid_frame_received;
00127   /** true if the shutter should actually be set, false otherwise */
00128   bool _do_set_shutter;
00129   /** true if the white balance should actually be set, false otherwise */
00130   bool _do_set_white_balance;
00131   /** true if the focus should actually be set, false otherwise */
00132   bool _do_set_focus;
00133 
00134   /** DC1394 main context */
00135   dc1394_t                      *_dc1394;
00136   /** DC1394 video mode */
00137   dc1394video_mode_t             _mode;
00138   /** Indicator of Format7 status. */
00139   bool                           _format7_mode_enabled;
00140   /** DC1394 speed */
00141   dc1394speed_t                  _speed;
00142   /** DC1394 framerate */
00143   dc1394framerate_t              _framerate;
00144   /** DC1394 camera handle */
00145   dc1394camera_t                *_camera;
00146   /** Last captured DC1394 video frame */
00147   dc1394video_frame_t           *_frame;
00148   /** Format7 color coding */
00149   dc1394color_coding_t           _format7_coding;
00150   /** Format7 bytes per packet */
00151   int                            _format7_bpp;
00152   /** Format7 width */
00153   int                            _format7_width;
00154   /** Format7 height */
00155   int                            _format7_height;
00156   /** Format7 ROI Start X coordinate */
00157   int                            _format7_startx;
00158   /** Format7 ROI Start Y coordinate */
00159   int                            _format7_starty;
00160 
00161   /** White balance U/B value */
00162   unsigned int                   _white_balance_ub;
00163   /** White balance V/R value */
00164   unsigned int                   _white_balance_vr;
00165 
00166   /** Shutter value */
00167   unsigned int                   _shutter;
00168 
00169   /** Focus value */
00170   unsigned int                   _focus;
00171 
00172   /** Gain value */
00173   unsigned int                   _gain;
00174   /** True, if gain is set automatically */
00175   bool                           _auto_gain;
00176 
00177   /** Camera model, used in open to identify the camera, if empty first found camera is used */
00178   char *_model;
00179 
00180 };
00181 
00182 } // end namespace firevision
00183 
00184 #endif

Generated on Tue Feb 22 13:31:15 2011 for Fawkes API by  doxygen 1.4.7