Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * net.h - This header defines an fuse network client camera 00004 * 00005 * Created: Wed Feb 01 12:22:06 2006 00006 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_CAMS_NET_H_ 00025 #define __FIREVISION_CAMS_NET_H_ 00026 00027 #include <cams/camera.h> 00028 #include <fvutils/net/fuse_client_handler.h> 00029 #include <vector> 00030 00031 namespace firevision { 00032 #if 0 /* just to make Emacs auto-indent happy */ 00033 } 00034 #endif 00035 00036 class CameraArgumentParser; 00037 class FuseClient; 00038 class FuseImageContent; 00039 class FuseNetworkMessage; 00040 class JpegImageDecompressor; 00041 00042 class NetworkCamera : public Camera, public FuseClientHandler 00043 { 00044 00045 public: 00046 NetworkCamera(const char *host, unsigned short port, bool jpeg = false); 00047 NetworkCamera(const char *host, unsigned short port, const char *image_id, 00048 bool jpeg = false); 00049 NetworkCamera(const CameraArgumentParser *cap); 00050 00051 virtual ~NetworkCamera(); 00052 00053 virtual void open(); 00054 virtual void start(); 00055 virtual void stop(); 00056 virtual void close(); 00057 virtual void flush(); 00058 virtual void capture(); 00059 virtual void print_info(); 00060 virtual bool ready(); 00061 00062 virtual unsigned char* buffer(); 00063 virtual unsigned int buffer_size(); 00064 virtual void dispose_buffer(); 00065 00066 virtual unsigned int pixel_width(); 00067 virtual unsigned int pixel_height(); 00068 virtual colorspace_t colorspace(); 00069 00070 virtual void set_image_id(const char *image_id); 00071 virtual void set_image_number(unsigned int n); 00072 00073 virtual fawkes::Time * capture_time(); 00074 00075 virtual std::vector<FUSE_imageinfo_t>& image_list(); 00076 00077 virtual void fuse_invalid_server_version(uint32_t local_version, 00078 uint32_t remote_version) throw(); 00079 virtual void fuse_connection_established() throw(); 00080 virtual void fuse_connection_died() throw(); 00081 virtual void fuse_inbound_received(FuseNetworkMessage *m) throw(); 00082 00083 private: 00084 bool __started; 00085 bool __opened; 00086 00087 bool __connected; 00088 unsigned int __local_version; 00089 unsigned int __remote_version; 00090 00091 char *__host; 00092 unsigned short __port; 00093 char *__image_id; 00094 00095 bool __get_jpeg; 00096 JpegImageDecompressor *__decompressor; 00097 unsigned char *__decompressed_buffer; 00098 unsigned int __last_width; 00099 unsigned int __last_height; 00100 00101 FuseClient *__fusec; 00102 FuseImageContent *__fuse_image; 00103 FuseNetworkMessage *__fuse_message; 00104 00105 FUSE_imageinfo_t *__fuse_imageinfo; 00106 00107 std::vector<FUSE_imageinfo_t> __image_list; 00108 }; 00109 00110 } // end namespace firevision 00111 00112 #endif