Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

zcameraio.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2003 Michael 'Mickey' Lauer.  All rights reserved.
00003 **
00004 ** This file is part of Opie Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 **********************************************************************/
00015 
00016 #ifndef ZCAMERAIO_H
00017 #define ZCAMERAIO_H
00018 
00019 #include <qobject.h>
00020 
00021 class QImage;
00022 class QTime;
00023 
00024 class ZCameraIO : public QObject
00025 {
00026   Q_OBJECT
00027 
00028   public:
00029     virtual ~ZCameraIO();
00030 
00031     enum ReadMode
00032     {
00033         IMAGE = 0, STATUS = 1,
00034         FASTER = 0, BETTER = 2,
00035         XNOFLIP = 0, XFLIP = 4,
00036         YNOFLIP = 0, YFLIP = 8,
00037         AUTOMATICFLIP = -1
00038     };
00039 
00040     // low level interface
00041 
00042     bool setCaptureFrame( int w, int h, int zoom = 256, bool rot = true );
00043     bool setZoom( int zoom = 0 );
00044     void setReadMode( int = IMAGE | XFLIP | YFLIP );
00045     void setFlip( int flip );
00046 
00047     bool isShutterPressed(); // not const, because it calls clearShutterLatch
00048     bool isAvailable() const;
00049     bool isCapturing() const;
00050     bool isFinderReversed() const;
00051 
00052     bool snapshot( QImage* image );
00053     bool snapshot( unsigned char* buf );
00054 
00055     // high level interface
00056     bool isOpen() const;
00057     static ZCameraIO* instance();
00058     void captureFrame( int w, int h, int zoom, QImage* image );
00059     void captureFrame( int w, int h, int zoom, unsigned char* buf );
00060 
00061   protected:
00062     ZCameraIO();
00063     void clearShutterLatch();
00064     void init();
00065     bool read( char*, int );
00066     bool write( char*, int = 0 );
00067 
00068   signals:
00069     void shutterClicked();
00070 
00071   private:
00072     int _driver;
00073     char _status[4];
00074     bool _pressed;
00075     static ZCameraIO* _instance;
00076     int _height;
00077     int _width;
00078     int _zoom;
00079     int _flip;
00080     bool _rot;
00081     int _readlen;
00082 
00083     QTime* _timer;
00084 };
00085 
00086 #endif

Generated on Sat Nov 5 16:17:31 2005 for OPIE by  doxygen 1.4.2