23#include <core/exception.h>
24#include <core/exceptions/software.h>
25#include <core/exceptions/system.h>
26#include <fvcams/shmem.h>
27#include <fvutils/system/camargp.h>
28#include <fvutils/writers/fvraw.h>
59 image_id_ = strdup(image_id);
60 deep_copy_ = deep_copy;
82 if (cap->
has(
"image_id")) {
83 image_id_ = strdup(cap->
get(
"image_id").c_str());
87 if (cap->
has(
"deep_copy")) {
88 deep_copy_ = (strcasecmp(cap->
get(
"deep_copy").c_str(),
"true") == 0);
104 if (deep_buffer_ != NULL) {
108 delete capture_time_;
112SharedMemoryCamera::init()
115 capture_time_ = NULL;
119 deep_buffer_ = (
unsigned char *)malloc(shm_buffer_->
data_size());
126 e.
append(
"Failed to open shared memory image");
170 return shm_buffer_->
buffer();
177 return colorspace_buffer_size(shm_buffer_->
colorspace(),
178 shm_buffer_->
width(),
195 return shm_buffer_->
width();
201 return shm_buffer_->
height();
213 return capture_time_;
Base class for exceptions in Fawkes.
void append(const char *format,...) noexcept
Append messages to the message list.
Expected parameter is missing.
System ran out of memory and desired operation could not be fulfilled.
bool try_lock_for_read()
Try to aquire lock on shared memory segment for reading.
size_t data_size() const
Get the size of the data-segment.
void lock_for_write()
Lock shared memory segment for writing.
void unlock()
Unlock memory.
bool try_lock_for_write()
Try to aquire lock on shared memory segment for writing.
void lock_for_read()
Lock shared memory segment for reading.
A class for handling time.
void set_time(const timeval *tv)
Sets the time.
bool has(std::string s) const
Check if an parameter was given.
std::string get(std::string s) const
Get the value of the given parameter.
virtual unsigned int pixel_width()
Width of image in pixels.
~SharedMemoryCamera()
Destructor.
virtual void lock_for_read()
Lock image for reading.
virtual unsigned int buffer_size()
Size of buffer.
virtual void stop()
Stop image transfer from the camera.
virtual void flush()
Flush image queue.
virtual colorspace_t colorspace()
Colorspace of returned image.
virtual bool try_lock_for_read()
Try to lock for reading.
virtual void dispose_buffer()
Dispose current buffer.
virtual void close()
Close camera.
virtual void print_info()
Print out camera information.
virtual void unlock()
Unlock buffer.
virtual void set_image_number(unsigned int n)
Set image number to retrieve.
virtual void start()
Start image transfer from the camera.
virtual void capture()
Capture an image.
virtual void open()
Open the camera.
virtual bool ready()
Camera is ready for taking pictures.
virtual unsigned char * buffer()
Get access to current image buffer.
SharedMemoryImageBuffer * shared_memory_image_buffer()
Get the shared memory image buffer.
virtual void lock_for_write()
Lock image for writing.
virtual fawkes::Time * capture_time()
Get the Time of the last successfully captured image.
virtual bool try_lock_for_write()
Try to lock for reading.
virtual unsigned int pixel_height()
Height of image in pixels.
SharedMemoryCamera(const char *image_id, bool deep_copy=false)
Constructor.
Shared memory image buffer.
unsigned int height() const
Get image height.
fawkes::Time capture_time() const
Get the time when the image was captured.
colorspace_t colorspace() const
Get color space.
unsigned int width() const
Get image width.
unsigned char * buffer() const
Get image buffer.
Fawkes library namespace.