00001 /* Copyright (C) 2002 Dominic Letourneau (dominic.letourneau@usherbrooke.ca) 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library 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 GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 #ifndef _BT848_H_ 00018 #define _BT848_H_ 00019 00020 #include "BufferedNode.h" 00021 #include "BaseException.h" 00022 #include "Image.h" 00023 #include <string> 00024 #include <pthread.h> 00025 #include <sys/signal.h> 00026 00027 namespace RobotFlow { 00028 00029 class Bt848 : public FD::BufferedNode { 00030 00031 00032 friend void* grabber_driver_thread (void *bt848); 00033 00034 public: 00035 00036 void newframe(int sig); 00037 00038 Bt848(std::string nodeName, FD::ParameterSet params); 00039 00040 virtual ~Bt848(); 00041 00042 virtual void calculate(int output_id, int count, FD::Buffer &out); 00043 00044 static const int MODE_16BITS; 00045 00046 void lock_grab(); 00047 00048 void unlock_grab(); 00049 00050 static Bt848 *m_instance; 00051 00052 private: 00053 00054 void initialize(int mode,int width, int height); 00055 void single_grab(); 00056 00057 int m_brightness; 00058 int m_contrast; 00059 int m_size; 00060 int m_width; 00061 int m_height; 00062 int m_mode; 00063 int m_device_descriptor; 00064 int m_frame_count; 00065 bool m_ready; 00066 00067 std::string m_device_name; 00068 unsigned char *m_grab_data; 00069 pthread_mutex_t m_mutex; 00070 pthread_t m_driver_thread; 00071 00072 //sigaction structure 00073 struct sigaction m_sigact; 00074 00075 //old sigaction structure 00076 struct sigaction m_oldact; 00077 00078 void *mmbuf; 00079 00080 FD::ObjectRef m_image; 00081 00082 int outputID; 00083 00084 bool m_thread_running; 00085 bool m_continuous; 00086 00087 }; 00088 00089 }//namespace RobotFlow 00090 #endif