Main Page | Class List | File List | Class Members | Examples

SC1ModCam.hpp

Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2004 Evan Heidtmann 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to 00006 deal in the Software without restriction, including without limitation the 00007 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 00008 sell copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00019 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 00020 IN THE SOFTWARE. 00021 00022 */ 00023 00084 #include <string> 00085 using namespace std; 00086 00102 class SC1ModCam { 00103 public: 00104 00105 SC1ModCam (string devname = "/dev/video", int parport = 0x378); 00106 ~SC1ModCam (); 00107 00108 unsigned long set_exposure (unsigned long msecs); // milliseconds 00109 unsigned long get_exposure (void); 00110 00111 unsigned long set_multiplier (unsigned int m); 00112 unsigned long get_multiplier (void); 00113 00114 unsigned int set_fps (unsigned int fps); 00115 unsigned int get_fps (void); 00116 00117 bool set_resolution (int width, int height); 00118 void get_resolution (int * width, int * height); 00119 00120 void * get_buffer (void); 00121 size_t get_buffer_size (void); 00122 00123 bool take_photo (); 00124 00125 enum ERRCODE { 00126 ERR_OK = 0, 00127 ERR_ERROR, 00128 ERR_WARN, 00129 ERR_FATAL, 00130 }; 00131 00132 enum ERRCODE error (string * msg = NULL); 00133 00134 protected: 00135 00136 void _set_error(string error, enum ERRCODE code = ERR_ERROR); 00137 void _unset_error(void); 00138 string _error_string; 00139 enum ERRCODE _error_code; 00140 00141 void * _buffer; 00142 int _multiplier; 00143 00144 int _fps; 00145 int _image_width; 00146 int _image_height; 00147 static const float _bytes_per_pixel = 1.5; 00148 00149 bool _sync_settings (void); 00150 bool _setup_camera (void); 00151 00152 // Parport functions 00153 bool _open_shutter(); 00154 bool _close_shutter(); 00155 00156 // Convenience function because usleep(3) is obsolete 00157 void _usleep (unsigned long usecs); 00158 00159 int _devfd; 00160 00161 }; 00162 00163 // vim:ts=4

Generated on Fri Jul 16 12:22:57 2004 for libsc1mod by doxygen 1.3.7