NetworkCamera Class Reference
Network camera. More...
#include <cams/net.h>

Public Member Functions | |
| NetworkCamera (const char *host, unsigned short port, bool jpeg=false) | |
| Constructor. | |
| NetworkCamera (const char *host, unsigned short port, const char *image_id, bool jpeg=false) | |
| Constructor. | |
| NetworkCamera (const CameraArgumentParser *cap) | |
| Constructor. | |
| virtual | ~NetworkCamera () |
| Destructor. | |
| virtual void | open () |
| Open the camera. | |
| virtual void | start () |
| Start image transfer from the camera. | |
| virtual void | stop () |
| Stop image transfer from the camera. | |
| virtual void | close () |
| Close camera. | |
| virtual void | flush () |
| Flush image queue. | |
| virtual void | capture () |
| Capture an image. | |
| virtual void | print_info () |
| Print out camera information. | |
| virtual bool | ready () |
| Camera is ready for taking pictures. | |
| virtual unsigned char * | buffer () |
| Get access to current image buffer. | |
| virtual unsigned int | buffer_size () |
| Size of buffer. | |
| virtual void | dispose_buffer () |
| Dispose current buffer. | |
| virtual unsigned int | pixel_width () |
| Width of image in pixels. | |
| virtual unsigned int | pixel_height () |
| Height of image in pixels. | |
| virtual colorspace_t | colorspace () |
| Colorspace of returned image. | |
| virtual void | set_image_id (const char *image_id) |
| Select the image that is opened. | |
| virtual void | set_image_number (unsigned int n) |
| Set image number to retrieve. | |
| virtual fawkes::Time * | capture_time () |
| Get the Time of the last successfully captured image. | |
| virtual std::vector < FUSE_imageinfo_t > & | image_list () |
| List the available images. | |
| virtual void | fuse_invalid_server_version (uint32_t local_version, uint32_t remote_version) throw () |
| Invalid version string received. | |
| virtual void | fuse_connection_established () throw () |
| Connection has been established. | |
| virtual void | fuse_connection_died () throw () |
| Connection died. | |
| virtual void | fuse_inbound_received (FuseNetworkMessage *m) throw () |
| Message received. | |
Detailed Description
Network camera.Retrieve images via network (FUSE).
- See also:
- FuseClient
Definition at line 37 of file net.h.
Constructor & Destructor Documentation
| 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:
-
host host to connect to port port to connect to jpeg if true jpeg images will be transferred and automatically be decompressed, otherwise raw images are transferred
| NetworkCamera::NetworkCamera | ( | const char * | host, | |
| unsigned short | port, | |||
| const char * | image_id, | |||
| bool | jpeg = false | |||
| ) |
| 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:
-
cap camera argument parser
Definition at line 135 of file net.cpp.
References CameraArgumentParser::get(), and CameraArgumentParser::has().
| NetworkCamera::~NetworkCamera | ( | ) | [virtual] |
Member Function Documentation
| unsigned char * 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 Camera.
Definition at line 276 of file net.cpp.
References FuseImageContent::buffer().
| unsigned int 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 Camera.
Definition at line 290 of file net.cpp.
References FuseImageContent::colorspace(), FuseImageContent::pixel_height(), pixel_height(), FuseImageContent::pixel_width(), and pixel_width().
Referenced by capture().
| void 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 Camera.
Definition at line 233 of file net.cpp.
References FuseImageContent::buffer(), FuseImageContent::buffer_size(), buffer_size(), JpegImageDecompressor::decompress(), FuseClient::enqueue_and_wait(), FUSE_imagereq_message_t::format, FUSE_imagereq_message_t::image_id, FuseImageContent::pixel_height(), FuseImageContent::pixel_width(), ImageDecompressor::set_compressed_buffer(), and ImageDecompressor::set_decompressed_buffer().
| fawkes::Time * 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:
-
NotImplementedException thrown if Camera does not support time stamping
Reimplemented from Camera.
Definition at line 356 of file net.cpp.
References FuseImageContent::capture_time().
| void NetworkCamera::close | ( | ) | [virtual] |
Close camera.
This closes the camera device. The camera must have been stopped before calling close().
Implements Camera.
Definition at line 306 of file net.cpp.
References fawkes::Thread::cancel(), FuseClient::disconnect(), dispose_buffer(), fawkes::Thread::join(), and stop().
Referenced by ~NetworkCamera().
| colorspace_t NetworkCamera::colorspace | ( | ) | [virtual] |
Colorspace of returned image.
- Returns:
- colorspace of image returned by buffer()
Implements Camera.
Definition at line 406 of file net.cpp.
References FUSE_imageinfo_t::colorspace.
| void 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 Camera.
Definition at line 325 of file net.cpp.
References fawkes::RefCount::unref().
| void 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 Camera.
Definition at line 366 of file net.cpp.
References dispose_buffer().
| void NetworkCamera::fuse_connection_died | ( | ) | throw () [virtual] |
| void NetworkCamera::fuse_connection_established | ( | ) | throw () [virtual] |
| void 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:
-
m message to handle
Implements FuseClientHandler.
Definition at line 462 of file net.cpp.
References FUSE_imageinfo_t::buffer_size, FUSE_imageinfo_t::colorspace, FuseImageListContent::has_next(), FUSE_imageinfo_t::height, FUSE_imageinfo_t::image_id, FuseImageListContent::next(), and FUSE_imageinfo_t::width.
| void 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_version version that the FuseClient speaks remote_version version that the remote FUSE server speaks.
Implements FuseClientHandler.
| std::vector< FUSE_imageinfo_t > & NetworkCamera::image_list | ( | ) | [virtual] |
List the available images.
- Returns:
- a vector containing information about the available images
Definition at line 424 of file net.cpp.
References FuseClient::enqueue_and_wait().
| void 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 Camera.
Definition at line 191 of file net.cpp.
References FuseClient::connect(), FuseClient::enqueue_and_wait(), FUSE_imagedesc_message_t::image_id, fawkes::Thread::start(), and FuseClient::wait_greeting().
| unsigned int NetworkCamera::pixel_height | ( | ) | [virtual] |
Height of image in pixels.
- Returns:
- height of image in pixels
Implements Camera.
Definition at line 346 of file net.cpp.
References FUSE_imageinfo_t::height.
Referenced by buffer_size().
| unsigned int NetworkCamera::pixel_width | ( | ) | [virtual] |
Width of image in pixels.
- Returns:
- width of image in pixels
Implements Camera.
Definition at line 336 of file net.cpp.
References FUSE_imageinfo_t::width.
Referenced by buffer_size().
| void NetworkCamera::print_info | ( | ) | [virtual] |
| bool NetworkCamera::ready | ( | ) | [virtual] |
| void NetworkCamera::set_image_id | ( | const char * | image_id | ) | [virtual] |
Select the image that is opened.
- Parameters:
-
image_id the image id
Definition at line 384 of file net.cpp.
References FuseClient::enqueue_and_wait(), and FUSE_imagedesc_message_t::image_id.
| void NetworkCamera::set_image_number | ( | unsigned int | n | ) | [virtual] |
| void 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 Camera.
| void NetworkCamera::stop | ( | ) | [virtual] |
The documentation for this class was generated from the following files:

