Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

l1394_dcccamera.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           l1394_dcccamera.h  -  description
00003                              -------------------
00004     begin                : Fri Nov 24 2000
00005     copyright            : (C) 2000-2004 by Michael Repplinger
00006     email                : repplinger@cs.uni-sb.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef DCCCAMERA_H
00019 #define DCCCAMERA_H
00020 #include "l1394_camera.h"
00021 #include "l1394_node.h"
00022 #include "l1394_dcciso.h"
00023 #include "l1394_dccregister.h"
00024 
00025 //ok
00026 namespace L1394{
00027 
00028 /*! \class DccCamera
00029   * \ingroup L1394_Node
00030   * \ingroup L1394_Device
00031   * \brief   This class implements the interface of a camera defined in the 1394-based Digital Camera
00032   * Specification. (Version 1.20)
00033   *
00034   * The mechanism to create commands is the same, as described in class Camera .
00035   *
00036   * The Session class provides also functions to get explicit DccCameras.
00037   * So the little example in the Camera class documentation can be changed, if you need a DccCamera.
00038   *
00039   * \code
00040   * Session* session = GetSession();
00041   * DccCamera* camera = session->findDccCamera(); //get explicit a DccCamera
00042   * if (camera == NULL)
00043   * {
00044   *   cout << "No DccCamera found" << endl;
00045   *   exit(0);
00046   * }
00047   * if (camera->zoom()->hasFeature())  //if the camera support zoom
00048   *   camera->zoom()->setValue(camera->zoom()->getMinValue()); //set zoom value to the minimum value.
00049   * else
00050   *   cout << " Feature not supported " << endl;
00051   * \endcode
00052   * For more information see the tutorial.
00053   *
00054   *@author Michael Repplinger
00055   */
00056 class DccCamera : public Node, public Camera
00057 {
00058 public:
00059 /*! \name DccCamera constructor
00060   * These functions creates the DccCamera objects.
00061   */
00062 //@{
00063 /*! \fn DccCamera(const u_int32_t node_id, const Card* parent)
00064   * \brief Constructor
00065   * \param node_id : specify the node_id by creating by instantiating the Node object.
00066   * \param parent  : pointer to the parent node
00067   */
00068   DccCamera(const u_int32_t node_id, const Card* parent);
00069 
00070 
00071 /*! \fn ~DccCamera()
00072   * \brief destructor
00073   */
00074   virtual ~DccCamera();
00075 //@}
00076 
00077 
00078 /** \name Camera information
00079   *  These functions return some camera specific information.
00080   */
00081 //@{
00082 /*! \fn getFeatureHiInquiry()
00083   * \brief This method reads the first feature Quadlet from a DccCamera.
00084   * \return Quadlet : first feature Quadlet.
00085   */
00086   Quadlet getFeatureHiInquiry() {Quadlet tmp_quadlet; read(DCC_BASE+0x404, &tmp_quadlet);return tmp_quadlet;}
00087 
00088 
00089 /*! \fn getFeatureLoInquiry()
00090   * \brief This method reads the second feature quadlet from a DccCamera.
00091   * \return Quadlet : second feature quadlet.
00092   */
00093   Quadlet getFeatureLoInquiry() {Quadlet tmp_quadlet; read(DCC_BASE+0x408, &tmp_quadlet);return tmp_quadlet;}
00094 
00095 
00096 /*! \fn hasVideoFormat(const Videomode videomode)
00097   * \brief This method tests, if a videomode is supported by a Camera.
00098   * \return bool : true if the videomode is supported, false if not
00099   */
00100   virtual bool hasVideoFormat(const Videomode videomode) ;
00101 
00102 
00103 /*! \fn hasFramerate(const Videomode videomode, const Framerate framerate)
00104   * \brief This method tests, if a framerate, with a videomode is supported.
00105   * \param videomode : the videomode for the framerate.
00106   * \param framerate : the framerate that should be tested.
00107   * \return bool : true, if a framerate is supported, false if not
00108   */
00109   virtual bool hasFramerate(const Videomode mode,const Framerate framerate) ;
00110 
00111 
00112 /*! \fn int setParameter(const int buffercount, const int channel, const Isomode isomode = DEVICE_ISO_RUN, const Videomode videomode, const Framerate framerate)
00113   * \brief This method initialize the camera and create the iso object
00114   * \param isomode : DEVICE_ISO_POLL for polling mode, DEVICE_ISO_RUN
00115   * for free running mode at a fixed framerate, DEVICE_ISO_ONESHOT for
00116   * one-shot mode or DEVICE_ISO_NO for camera control only
00117   * \param nbuffers : number of iso-buffers (frames)
00118   * \param videomode : DEVICE_160x120_YUV_444, DEVICE_320x240_YUV_422,
00119   * DEVICE_640x480_YUV_411 or DEVICE_640x480_YUV_422.....
00120   * \param framerate : DEVICE_FRAMES_3_75, DEVICE_FRAMES_7_5,
00121   * DEVICE_FRAMES_15, DEVICE_FRAMES_30, DEVICE_FRAMES_60
00122   * \param channel : iso channel (a value between 1..64)
00123   * \return int : return a int value >= 0 if init success else < 0;
00124   */
00125   virtual int setParameter(const int buffercount = 2, const int channel = FREE_ISO_CHANNEL, const Isomode isomode = DEVICE_ISO_RUN, const Videomode videomode = DEVICE_320x240_YUV_422, const Framerate framerate = DEVICE_FRAMES_30);
00126 //@}
00127 
00128 /** \name Basic functions
00129   *  These functions implement the basic functions, defined in abstract class Device.
00130   */
00131 //@{
00132 /*! \fn start()
00133   * \brief This method starts the camera.
00134   * \return int : returns a value <=0 if an error occur, else >0
00135   */
00136   virtual int start()  ;
00137 
00138 
00139 /*! \fn stop()
00140  * \brief This method stops a sending camera
00141  * \return int : returns a value <=0 if an error occur, else >0
00142  */
00143   virtual int stop()  ;
00144 
00145 
00146 /*! \fn shot()
00147   * \brief This method sends a command to the DccCamera to send one frame.
00148   *
00149   * The command getFrame() use this function.
00150   */
00151   virtual void shot();
00152 
00153 
00154 /*! \fn multiShot(unsigned int)
00155   * \brief This method enables multiShot.
00156   */
00157   virtual void multiShot(unsigned int);
00158 
00159 
00160 /*! \fn getFrame()
00161   * \brief This method returns a pointer to the actual frame of a DccCamera.
00162   *
00163   *  The method blocks, until it receive a frame from video module.
00164   *  \return  unsigned char* : pointer to the frame
00165   */
00166   virtual Frame* getFrame() ;
00167 
00168 
00169 /*! \fn getIsoObject() const
00170   * \brief This method returns the current Iso object
00171   */
00172   virtual Iso* getIsoObject() const {return isoctx;}
00173 
00174 
00175 /*! \fn init()
00176   * \brief This method inits the camera to the parameter set by the function
00177   * setParameter() .
00178   *
00179   * You must call this method before the camera sends a frame.
00180   * \return L1394_SUCCESS if the init-process sucess, els L1394_FAILED. The init process
00181   * (normaly) fails, if the camera does not support the actual video_mode
00182   */
00183   virtual int init() ;
00184 //@}
00185 
00186 
00187 /** \name DccCamera control interface
00188   * These functions describe the interface of a camera
00189   */
00190 //@{
00191   //! Access 'Brightness' feature register
00192   virtual const CameraRegister* brightness()      {return dcc_register->setOffset(0x0); }
00193 
00194   //! Access 'Auto-Exposure' feature CDC_register
00195   virtual const CameraRegister* autoExposure()    {return dcc_register->setOffset(0x4); }
00196 
00197   //! Access 'Sharpness' feature dcc_register
00198   virtual const CameraRegister* sharpness()       {return dcc_register->setOffset(0x8); }
00199 
00200   //! Access 'White-Balance' feature dcc_register
00201   virtual const CameraRegister* whiteBalance()    {return dcc_register->setOffset(0xc)->setWhiteBalance((bool)1);}
00202 
00203   //! Access 'White-Balance' feature dcc_register
00204   virtual const CameraRegister* whiteBalance(int value)    {return dcc_register->setOffset(0xc)->setWhiteBalance((bool)value);}
00205 
00206   //! Access 'Hue' feature dcc_register
00207   virtual const CameraRegister* hue()             {return dcc_register->setOffset(0x10); }
00208 
00209   //! Access 'Saturation' feature dcc_register
00210   virtual const CameraRegister* saturation()     {return dcc_register->setOffset(0x14); }
00211 
00212   //! Access 'Gamma' feature dcc_register
00213   virtual const CameraRegister* gamma()           {return dcc_register->setOffset(0x18); }
00214 
00215   //! Access 'Shutter' feature dcc_register
00216   virtual const CameraRegister* shutter()         {return dcc_register->setOffset(0x1c); }
00217 
00218   //! Access 'Gain' feature dcc_register
00219   virtual const CameraRegister* gain()           {return dcc_register->setOffset(0x20); }
00220 
00221   //! Access 'Iris' feature dcc_register
00222   virtual const CameraRegister* iris()           {return dcc_register->setOffset(0x24); }
00223 
00224   //! Access 'Focus' feature dcc_register
00225   virtual const CameraRegister* focus()           {return dcc_register->setOffset(0x28); }
00226 
00227   //! Access 'Temperature' feature dcc_register
00228   virtual const CameraRegister* temperature()    {return dcc_register->setOffset(0x2c); }
00229 
00230   //! Access 'Trigger' feature dcc_register
00231   virtual const CameraRegister* trigger()        {return dcc_register->setOffset(0x30); }
00232 
00233   //! Access 'Zoom' feature dcc_register
00234   virtual const CameraRegister* zoom()           {return dcc_register->setOffset(0x80); }
00235 
00236   //! Access 'Pan' feature dcc_register
00237   virtual const CameraRegister* pan()             {return dcc_register->setOffset(0x84); }
00238 
00239   //! Access 'Tilt' feature dcc_register
00240   virtual const CameraRegister* tilt()           {return dcc_register->setOffset(0x88); }
00241 
00242   //! Access 'Filter' feature dcc_register
00243   virtual const CameraRegister* filter()         {return dcc_register->setOffset(0x8c); }
00244 //@}
00245   void setFramerate(const Framerate framerate);
00246 protected:
00247   void setFramerate();
00248   void setVideoMode();
00249 private:
00250   //! disabled copy constructor
00251   DccCamera(const DccCamera&);
00252 
00253   //iso object and csrrom
00254    mutable internal::DccIso *isoctx;
00255   internal::CsrRom* rom_info;
00256 
00257   //camera parameter
00258   mutable  int channel, frame_buffer;
00259   Videomode video_mode;
00260   Framerate frame_rate;
00261   Isomode   imode;
00262 
00263   DccRegister* dcc_register;
00264 
00265   mutable Quadlet tmp_quadlet;
00266   mutable int is_init;
00267 
00268   ThreadMutex mutex;
00269 };
00270 
00271 }    //namespace L1394
00272 #endif

Generated on Wed Aug 24 00:36:40 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/