Fawkes API  Fawkes Development Version
firevision::NetworkCamera Class Reference

#include <>>

Inheritance diagram for firevision::NetworkCamera:

Public Member Functions

 NetworkCamera (const char *host, unsigned short port, bool jpeg=false)
 Constructor. More...
 
 NetworkCamera (const char *host, unsigned short port, const char *image_id, bool jpeg=false)
 Constructor. More...
 
 NetworkCamera (const CameraArgumentParser *cap)
 Constructor. More...
 
virtual ~NetworkCamera ()
 Destructor. More...
 
virtual void open ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void close ()
 
virtual void flush ()
 
virtual void capture ()
 
virtual void print_info ()
 
virtual bool ready ()
 
virtual unsigned char * buffer ()
 
virtual unsigned int buffer_size ()
 
virtual void dispose_buffer ()
 
virtual unsigned int pixel_width ()
 
virtual unsigned int pixel_height ()
 
virtual colorspace_t colorspace ()
 
virtual void set_image_id (const char *image_id)
 Select the image that is opened. More...
 
virtual void set_image_number (unsigned int n)
 
virtual fawkes::Timecapture_time ()
 Get the Time of the last successfully captured image. More...
 
virtual std::vector< FUSE_imageinfo_t > & image_list ()
 List the available images. More...
 
virtual void fuse_invalid_server_version (uint32_t local_version, uint32_t remote_version) throw ()
 
virtual void fuse_connection_established () throw ()
 
virtual void fuse_connection_died () throw ()
 
virtual void fuse_inbound_received (FuseNetworkMessage *m) throw ()
 
- Public Member Functions inherited from firevision::Camera
virtual ~Camera ()
 Virtual empty destructor. More...
 
- Public Member Functions inherited from firevision::FuseClientHandler
virtual ~FuseClientHandler ()
 Destructor. More...
 

Detailed Description

Network camera. Retrieve images via network (FUSE).

See also
FuseClient
Author
Tim Niemueller

Definition at line 46 of file net.h.

Constructor & Destructor Documentation

◆ NetworkCamera() [1/3]

firevision::NetworkCamera::NetworkCamera ( const char *  host,
unsigned short  port,
bool  jpeg = false 
)

Constructor.

Allows to initiate a NetworkCamera w/o specifying an image id. This can be done later with the set_image_id() method.

Parameters
hosthost to connect to
portport to connect to
jpegif true jpeg images will be transferred and automatically be decompressed, otherwise raw images are transferred

Definition at line 58 of file net.cpp.

◆ NetworkCamera() [2/3]

firevision::NetworkCamera::NetworkCamera ( const char *  host,
unsigned short  port,
const char *  image_id,
bool  jpeg = false 
)

Constructor.

Parameters
hosthost to connect to
portport to connect to
image_idimage ID of image to retrieve
jpegif true jpeg images will be transferred and automatically be decompressed, otherwise raw images are transferred

Definition at line 93 of file net.cpp.

◆ NetworkCamera() [3/3]

firevision::NetworkCamera::NetworkCamera ( const CameraArgumentParser cap)

Constructor.

Initialize with parameters from camera argument parser, supported values are:

  • host=HOST, hostname or IP of host to connect to
  • port=PORT, port number to connect to
  • image=ID, image ID of image to retrieve
  • jpeg=<true|false>, if true JPEGs are recieved and decompressed otherwise raw images will be transferred (raw is the default)
    Parameters
    capcamera argument parser

Definition at line 133 of file net.cpp.

References firevision::CameraArgumentParser::get(), and firevision::CameraArgumentParser::has().

◆ ~NetworkCamera()

firevision::NetworkCamera::~NetworkCamera ( )
virtual

Destructor.

Definition at line 176 of file net.cpp.

Member Function Documentation

◆ buffer()

unsigned char * firevision::NetworkCamera::buffer ( )
virtual

Get access to current image buffer. This will return a pointer to the current buffer. The buffer contains an image of the given colorspace, width and height.

Returns
pointer to image buffer

Implements firevision::Camera.

Definition at line 272 of file net.cpp.

◆ buffer_size()

unsigned int firevision::NetworkCamera::buffer_size ( )
virtual

Size of buffer. Gets the size in bytes of the buffer returned by buffer().

Returns
size of buffer in bytes

Implements firevision::Camera.

Definition at line 286 of file net.cpp.

◆ capture()

void firevision::NetworkCamera::capture ( )
virtual

Capture an image. Although cameras shall operate with a continuous image flow where possible sometimes capturing an image means copying a buffer or advancing a buffer list pointer. This shall be done in this method. For a camera-using application it is mandatory to call capture() just before accessing the image buffer.

Implements firevision::Camera.

Definition at line 229 of file net.cpp.

References firevision::FUSE_imagereq_message_t::format, and firevision::FUSE_imagereq_message_t::image_id.

◆ capture_time()

fawkes::Time * firevision::NetworkCamera::capture_time ( )
virtual

Get the Time of the last successfully captured image.

Returns a Time representing the time when the last image was captured successfully. Note that calling this function is only valid after capture() and before dispose_buffer() has been called – it is only valid when an image is currently available.

Returns
Time of the currently processed image. The pointer shall be valid at least until the next call to dispose_buffer().
Exceptions
NotImplementedExceptionthrown if Camera does not support time stamping

Reimplemented from firevision::Camera.

Definition at line 352 of file net.cpp.

◆ close()

void firevision::NetworkCamera::close ( )
virtual

Close camera. This closes the camera device. The camera must have been stopped before calling close().

Implements firevision::Camera.

Definition at line 302 of file net.cpp.

◆ colorspace()

colorspace_t firevision::NetworkCamera::colorspace ( )
virtual

Colorspace of returned image.

Returns
colorspace of image returned by buffer()

Implements firevision::Camera.

Definition at line 400 of file net.cpp.

◆ dispose_buffer()

void firevision::NetworkCamera::dispose_buffer ( )
virtual

Dispose current buffer. Some cameras need disposal of the current buffer (for example to free space in a queue to retrieve the next image). This is done with this method. It has to be called after all work has been done on the image as desired. After dispose_buffer() has been called no further access may happen to the image buffer or undesired behavior may happen.

Implements firevision::Camera.

Definition at line 321 of file net.cpp.

◆ flush()

void firevision::NetworkCamera::flush ( )
virtual

Flush image queue. Some cameras may have an image buffer queue. With this it can happen that if the processing of an image took longer than desired it is needed to flush this buffer queue.

Implements firevision::Camera.

Definition at line 362 of file net.cpp.

◆ fuse_connection_died()

void firevision::NetworkCamera::fuse_connection_died ( )
throw (
)
virtual

Connection died.

Implements firevision::FuseClientHandler.

Definition at line 444 of file net.cpp.

◆ fuse_connection_established()

void firevision::NetworkCamera::fuse_connection_established ( )
throw (
)
virtual

Connection has been established.

Implements firevision::FuseClientHandler.

Definition at line 438 of file net.cpp.

◆ fuse_inbound_received()

void firevision::NetworkCamera::fuse_inbound_received ( FuseNetworkMessage m)
throw (
)
virtual

Message received. An incoming message has been received and can now be processed. Note that if you want to work on the message after this method has finished you have to reference the message by calling FuseMessage::ref()!

Parameters
mmessage to handle

Implements firevision::FuseClientHandler.

Definition at line 450 of file net.cpp.

References firevision::FUSE_imageinfo_t::buffer_size, firevision::FUSE_imageinfo_t::colorspace, firevision::FuseImageListContent::has_next(), firevision::FUSE_imageinfo_t::height, firevision::FUSE_imageinfo_t::image_id, firevision::FuseImageListContent::next(), and firevision::FUSE_imageinfo_t::width.

◆ fuse_invalid_server_version()

void firevision::NetworkCamera::fuse_invalid_server_version ( uint32_t  local_version,
uint32_t  remote_version 
)
throw (
)
virtual

Invalid version string received. The remote end has a different incompatible FUSE version.

Parameters
local_versionversion that the FuseClient speaks
remote_versionversion that the remote FUSE server speaks.

Implements firevision::FuseClientHandler.

Definition at line 431 of file net.cpp.

◆ image_list()

std::vector< FUSE_imageinfo_t > & firevision::NetworkCamera::image_list ( )
virtual

List the available images.

Returns
a vector containing information about the available images

Definition at line 417 of file net.cpp.

◆ open()

void firevision::NetworkCamera::open ( )
virtual

Open the camera. The camera is opened, but image transfer not yet started. This can be used to detect general problems with the camera while delaying the real transfer startup until it is needed.

Implements firevision::Camera.

Definition at line 188 of file net.cpp.

References firevision::FUSE_imagedesc_message_t::image_id.

◆ pixel_height()

unsigned int firevision::NetworkCamera::pixel_height ( )
virtual

Height of image in pixels.

Returns
height of image in pixels

Implements firevision::Camera.

Definition at line 342 of file net.cpp.

◆ pixel_width()

unsigned int firevision::NetworkCamera::pixel_width ( )
virtual

Width of image in pixels.

Returns
width of image in pixels

Implements firevision::Camera.

Definition at line 332 of file net.cpp.

◆ print_info()

void firevision::NetworkCamera::print_info ( )
virtual

Print out camera information. Shall print out camera information and current setup information on stdout.

Implements firevision::Camera.

Definition at line 224 of file net.cpp.

◆ ready()

bool firevision::NetworkCamera::ready ( )
virtual

Camera is ready for taking pictures. The camera has been opened and started correctly and may now provide images.

Returns
true, if the camera is ready, false otherwise

Implements firevision::Camera.

Definition at line 370 of file net.cpp.

◆ set_image_id()

void firevision::NetworkCamera::set_image_id ( const char *  image_id)
virtual

Select the image that is opened.

Parameters
image_idthe image id

Definition at line 379 of file net.cpp.

References firevision::FUSE_imagedesc_message_t::image_id.

◆ set_image_number()

void firevision::NetworkCamera::set_image_number ( unsigned int  n)
virtual

Set image number to retrieve. If a camera is able to retrieve several images this method can be used to select the image to be retrieved with the next call to capture().

Parameters
nimage number to set

Implements firevision::Camera.

Definition at line 394 of file net.cpp.

◆ start()

void firevision::NetworkCamera::start ( )
virtual

Start image transfer from the camera. For many cameras opening the camera and starting transmission of images are two tasks. This method will simply initiate the transfer after the camera as been opened. And exception shall be thrown if the camera has not been opened.

Implements firevision::Camera.

Definition at line 212 of file net.cpp.

◆ stop()

void firevision::NetworkCamera::stop ( )
virtual

Stop image transfer from the camera. This will stop the image transfer initiated with start(). This can be used to start and stop the image transfer at will without opening and closing operations inbetween.

Implements firevision::Camera.

Definition at line 218 of file net.cpp.


The documentation for this class was generated from the following files: