Fawkes API Fawkes Development Version
net.h
1
2/***************************************************************************
3 * net.h - This header defines an fuse network client camera
4 *
5 * Created: Wed Feb 01 12:22:06 2006
6 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _FIREVISION_CAMS_NET_H_
25#define _FIREVISION_CAMS_NET_H_
26
27#include <fvcams/camera.h>
28#include <fvutils/net/fuse_client_handler.h>
29
30#include <vector>
31
32namespace firevision {
33
34class CameraArgumentParser;
35class FuseClient;
36class FuseImageContent;
37class FuseNetworkMessage;
38class JpegImageDecompressor;
39
41{
42public:
43 NetworkCamera(const char *host, unsigned short port, bool jpeg = false);
44 NetworkCamera(const char *host, unsigned short port, const char *image_id, bool jpeg = false);
46
47 virtual ~NetworkCamera();
48
49 virtual void open();
50 virtual void start();
51 virtual void stop();
52 virtual void close();
53 virtual void flush();
54 virtual void capture();
55 virtual void print_info();
56 virtual bool ready();
57
58 virtual unsigned char *buffer();
59 virtual unsigned int buffer_size();
60 virtual void dispose_buffer();
61
62 virtual unsigned int pixel_width();
63 virtual unsigned int pixel_height();
64 virtual colorspace_t colorspace();
65
66 virtual void set_image_id(const char *image_id);
67 virtual void set_image_number(unsigned int n);
68
69 virtual fawkes::Time *capture_time();
70
71 virtual std::vector<FUSE_imageinfo_t> &image_list();
72
73 virtual void fuse_invalid_server_version(uint32_t local_version,
74 uint32_t remote_version) noexcept;
75 virtual void fuse_connection_established() noexcept;
76 virtual void fuse_connection_died() noexcept;
77 virtual void fuse_inbound_received(FuseNetworkMessage *m) noexcept;
78
79private:
80 bool started_;
81 bool opened_;
82
83 bool connected_;
84 unsigned int local_version_;
85 unsigned int remote_version_;
86
87 char * host_;
88 unsigned short port_;
89 char * image_id_;
90
91 bool get_jpeg_;
92 JpegImageDecompressor *decompressor_;
93 unsigned char * decompressed_buffer_;
94 unsigned int last_width_;
95 unsigned int last_height_;
96
97 FuseClient * fusec_;
98 FuseImageContent * fuse_image_;
99 FuseNetworkMessage *fuse_message_;
100
101 FUSE_imageinfo_t *fuse_imageinfo_;
102
103 std::vector<FUSE_imageinfo_t> image_list_;
104};
105
106} // end namespace firevision
107
108#endif
A class for handling time.
Definition: time.h:93
Camera argument parser.
Definition: camargp.h:36
Camera interface for image aquiring devices in FireVision.
Definition: camera.h:33
FUSE Network Message.
Definition: fuse_message.h:40
Decompressor for JPEG images.
Network camera.
Definition: net.h:41
virtual void open()
Open the camera.
Definition: net.cpp:188
virtual unsigned int pixel_height()
Height of image in pixels.
Definition: net.cpp:342
virtual ~NetworkCamera()
Destructor.
Definition: net.cpp:176
virtual void stop()
Stop image transfer from the camera.
Definition: net.cpp:218
virtual bool ready()
Camera is ready for taking pictures.
Definition: net.cpp:370
virtual std::vector< FUSE_imageinfo_t > & image_list()
List the available images.
Definition: net.cpp:417
virtual colorspace_t colorspace()
Colorspace of returned image.
Definition: net.cpp:400
virtual void fuse_inbound_received(FuseNetworkMessage *m) noexcept
Message received.
Definition: net.cpp:450
virtual void fuse_connection_established() noexcept
Connection has been established.
Definition: net.cpp:438
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
Definition: net.cpp:394
virtual unsigned char * buffer()
Get access to current image buffer.
Definition: net.cpp:272
virtual void print_info()
Print out camera information.
Definition: net.cpp:224
virtual void fuse_connection_died() noexcept
Connection died.
Definition: net.cpp:444
virtual unsigned int buffer_size()
Size of buffer.
Definition: net.cpp:286
virtual void start()
Start image transfer from the camera.
Definition: net.cpp:212
virtual void flush()
Flush image queue.
Definition: net.cpp:362
NetworkCamera(const char *host, unsigned short port, bool jpeg=false)
Constructor.
Definition: net.cpp:58
virtual fawkes::Time * capture_time()
Get the Time of the last successfully captured image.
Definition: net.cpp:352
virtual void close()
Close camera.
Definition: net.cpp:302
virtual unsigned int pixel_width()
Width of image in pixels.
Definition: net.cpp:332
virtual void dispose_buffer()
Dispose current buffer.
Definition: net.cpp:321
virtual void set_image_id(const char *image_id)
Select the image that is opened.
Definition: net.cpp:379
virtual void capture()
Capture an image.
Definition: net.cpp:229
virtual void fuse_invalid_server_version(uint32_t local_version, uint32_t remote_version) noexcept
Invalid version string received.
Definition: net.cpp:431
Image info message.
Definition: fuse.h:168