CanonDriver.h
Go to the documentation of this file.
00001 #ifndef CANON_DRIVER_H
00002 #define CANON_DRIVER_H
00003 
00004 #include <vector>
00005 #include "../libSock/Socket.h"
00006 #include "Datagram.h"
00007 
00008 #include "CommManager.h"
00009 #include "VideoManager.h"
00010 
00011 class CanonDriver
00012 {
00013     public :
00014         const static unsigned int CONTROL_PORT = 65311;
00015         const static unsigned int VIDEO_PORT = 65310;
00016     protected :
00017 
00018         bool connected;
00019         unsigned int verbose;
00020         CommManager cm;
00021         VideoManager vm;
00022         char * host;
00023 
00024         bool sendRequestAndWait(unsigned char id, unsigned short status, 
00025                 Datagram & dgm,unsigned char * data=NULL, 
00026                 unsigned int datasize=0);
00027         bool sendAndWait(unsigned char id, unsigned short status, 
00028                 unsigned char * data=NULL, unsigned int datasize=0);
00029         bool sendAndWait33(unsigned char id, unsigned short status, 
00030                 unsigned char * data=NULL, unsigned int datasize=0);
00031         bool interpreteDatagram33(const Datagram & dgm);
00032         double cpan,ctilt,czoom;
00033 
00034     public :
00035         CanonDriver(const char * initseq_filename,
00036                 const char * hostname);
00037         ~CanonDriver();
00038 
00039         bool connect();
00040         bool disconnect();
00041         bool requestCurrentPos();
00042         void getCurrentPos(double * pan, double * tilt, double * zoom);
00043 
00044         bool moveTo(double pan, double tilt, double zoom);
00045         bool panTo(double pan);
00046         bool tiltTo(double to);
00047         bool zoomTo(double zoom);
00048 
00049         bool center();
00050         typedef enum {
00051             None=0, Right=1, Left=2, Up=4, UpRight=5, 
00052             UpLeft=6, Down=8, DownRight=9, DownLeft=10
00053         } Direction;
00054         bool startMoving(Direction dir);
00055         bool stop();
00056 
00057         bool startDeZooming();
00058         bool startZooming();
00059         bool stopZooming();
00060 
00061         // speed in 0x221 - 0x884 (degree/sec)
00062         bool setPanSpeed(unsigned short speed);
00063         // speed in 0x198 - 0x663 (degree/sec)
00064         bool setTiltSpeed(unsigned short speed);
00065         // speed in 1 - 7 (used in the win app)
00066         bool setZoomSpeed(unsigned short speed);
00067         bool getSpeeds(unsigned short * pan, unsigned short * tilt,
00068                 unsigned short * zoom);
00069 
00070         bool setMaxSpeed();
00071         bool setMinSpeed();
00072 
00073         typedef enum {FMAuto=0, FMAutoDomes=3, FMInfinity=2, FMManual=1} FocusMode;
00074         typedef enum {FMUndef=0, FMManualFar=1, FMManualNear=2} ManualFocusMode;
00075         bool setFocusMode(FocusMode fm, ManualFocusMode mfm=FMUndef);
00076         bool getFocusMode(FocusMode * fm, ManualFocusMode * mfm);
00077 
00079         typedef enum {AXPundef=0,AXPmode1=0x120,AXPmode2=0x1b0,AXPmode3=0x240,AXPmode4=0x2d0} AutoExposureMode;
00080         bool getAutoExposure(bool * autoexp, AutoExposureMode * aem);
00081         bool setAutoExposure(AutoExposureMode aem = AXPundef);
00082         bool setManualExposure();
00083         /***
00084          * aperture in 0x00 - 0x0F
00085          * inv_shutter in 0x01 - 0xfa (1/1 sec to 1/250 sec)
00086          * gain in 0x01 - 0x100
00087          * **/
00088         bool setExposureParameters(unsigned int aperture, 
00089                 unsigned int inv_shutter, unsigned int gain);
00090         bool getExposureParameters(unsigned int * aperture, 
00091                 unsigned int * inv_shutter, unsigned int * gain);
00092 
00093         bool setDigitalZoom(unsigned char zoom);
00094         unsigned char getDigitalZoom();
00095 
00096         bool setNightMode(bool activated=true);
00097         bool getNightMode();
00098         bool setInfraRed(bool activated=true);
00099         bool getInfraRed();
00100 
00102         // TODO : test other modes
00103         bool setImageSize(unsigned int width, unsigned int height);
00104         bool getImageSize(unsigned int  *width, unsigned int *height);
00105 
00106         bool startVideoReception(unsigned char * dst, 
00107                 VideoManager::SignalF f, void * farg=NULL);
00108         bool startVideoReception(VideoManager::SignalF f,
00109                 void * farg=NULL);
00110         void setVideoOutputColorSpace(JpegReader::ColorSpace cspace);
00111         bool pauseVideoReception();
00112         bool resumeVideoReception();
00113         bool setVideoReceptionPauseStatus(bool pause);
00114         bool getVideoReceptionPauseStatus();
00115         bool getVideoRecordingStatus() const;
00116         void setVideoRecordingMode(bool mode);
00117         bool stopVideoReception();              
00118         void setRecordingDestination(const char * dirname);
00119         void startVideoRecording();             
00120         void stopVideoRecording();              
00121         void setMaxFrameRate();
00122         void setFrameRate(double fps);
00123         double getRequiredFrameRate();
00124         double getObservedFrameRate();
00125 
00126         void setVerboseLevel(unsigned int v) {
00127             verbose = v;
00128             printf("Verbose level set to %d\n",verbose);
00129         }
00130 
00131         bool sendDatagram(const std::vector<unsigned char> & dgm);
00132 
00133 };
00134 
00135 #endif // CANON_DRIVER_H


canon_vbc50i
Author(s): Cedric Pradalier
autogenerated on Mon Jan 6 2014 11:18:27