inc/flexCAM.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2007 - Nastasi Christian
00003 This program is free software; you can redistribute it and/or
00004 modify it under the terms of the GNU General Public License
00005 as published by the Free Software Foundation; either version 2
00006 of the License, or (at your option) any later version.
00007 
00008 This program is distributed in the hope that it will be useful,
00009 but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License
00014 along with this program; if not, write to the Free Software
00015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00016 */
00017 
00018 #ifndef _flexCAM_h
00019 #define _flexCAM_h
00020 
00021 #include "flexSerial.h"
00022 #include "flexUtils.h"
00023 
00122 #define FLEX_CAM_GRAY2 0x1
00123 #define FLEX_CAM_GRAY4 0x2 
00124 #define FLEX_CAM_GRAY8 0x3 
00125 #define FLEX_CAM_RGB12 0x5 
00126 #define FLEX_CAM_RGB16 0x6 
00127 #define FLEX_CAM_JPEG  0x7 
00128 
00129 #define FLEX_CAM_SMALL  0x1 
00130 #define FLEX_CAM_MED    0x3 
00131 #define FLEX_CAM_LARGE  0x5 
00132 
00137 #define FLEX_ERR_SERIAL_CLOSED          0       
00138 #define FLEX_ERR_SERIAL_OPEN            1       
00139 #define FLEX_ERR_SERIAL_READ            2       
00140 #define FLEX_ERR_SERIAL_WRITE           3       
00141 #define FLEX_ERR_BAD_ACK                4       
00142 #define FLEX_ERR_BAD_COLOR_TYPE         5       
00143 #define FLEX_ERR_BAD_RES_TYPE           6       
00144 #define FLEX_ERR_NOT_INIT               7       
00145 #define FLEX_ERR_NOT_CONFIG             8       
00146 #define FLEX_ERR_SERIAL_TIMEOUT         9       
00147 #define FLEX_ERR_JPEG_DECOMPRESS        10      
00150 #ifdef __CYGWIN__ 
00151 #define FLEX_DEFAULT_SERIAL_PORT "com1"         
00152 #else
00153 #define FLEX_DEFAULT_SERIAL_PORT "/dev/ttys0"
00154 #endif
00155 
00159 class FlexCAM {
00160 
00161 private:
00162         unsigned char color_type;       
00163         unsigned char resolution_type;
00164         unsigned long int baud_rate_pc;
00165         //unsigned char baud_rate_flex;
00166         bool video_stream;
00167         bool compression;
00168         
00169         Flex_Serial serial_port;
00170 
00171         unsigned int error_code;
00172         unsigned int width;
00173         unsigned int height;
00174         unsigned int channel;
00175         unsigned int data_size;
00176 
00177         unsigned char* buff1;
00178         unsigned char* buff2;
00179 
00180         bool connected;
00181         bool init;
00182         bool config;
00183 
00184 public:
00185         
00189         FlexCAM();
00190         
00200         bool set_image_type(unsigned char type, unsigned char size, bool is_video);
00201 
00207         inline void set_baud_rate_pc(unsigned long int b){ baud_rate_pc=b; };
00208 
00214         inline unsigned int get_error(){ return error_code; };
00220         inline unsigned int get_width(){ return width; };
00226         inline unsigned int get_height(){ return height; };
00234         inline unsigned int get_channel(){ return channel; };
00235         
00247         bool connect(const char* serial_name);
00248 
00252         void close();
00253 
00263         bool configure(const char* serial_name);
00264 
00278         bool get_image(unsigned char* &image);
00279 };
00280 
00281 
00282 #endif
00283 
00284 

Generated on Wed Apr 23 00:11:08 2008 for Flex CAM Serial by  doxygen 1.5.4