00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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
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();
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
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