23 #include <fvutils/ipc/shm_image.h> 24 #include <fvutils/ipc/shm_lut.h> 25 #include <utils/system/argparser.h> 26 #include <fvutils/writers/fvraw.h> 37 main(
int argc,
char **argv)
41 bool action_done =
false;
45 cout << endl <<
"Usage: " << argv[0] <<
" [-h] [-c] [-c[t]] [-l] [-i image_id] [file]" << endl
46 <<
" -h Show this help message" << endl
47 <<
" -i id Save image ID to file" << endl
48 <<
" -c[t] Cleanup (remove all FireVision related shmem segments of given type)" 50 <<
" -l[t] List shared memory segments of given type" << endl
52 <<
" [t] type is a combination of" << endl
53 <<
" i images" << endl
54 <<
" l lookup tables" << endl
55 <<
" or empty in which case all known shared memory segments are mangled" << endl
57 <<
" [file] is a file name. Content depends on the action. The possibilities are: " << endl
58 <<
" for -i File where the saved image is stored" << endl
60 <<
"By default all known shared memory segments are listed" << endl
66 printf(
"You have to give a file name where to store the image\n");
68 const char *image_id = argp->
arg(
"i");
78 printf(
"Image '%s' saved to %s\n", image_id, argp->
items()[0]);
80 printf(
"Failed top save image\n");
87 if ( (tmp = argp->
arg(
"c")) != NULL) {
88 if ( strchr(tmp,
'i') != NULL) {
89 SharedMemoryImageBuffer::cleanup();
91 if ( strchr(tmp,
'l') != NULL) {
92 SharedMemoryLookupTable::cleanup();
95 SharedMemoryImageBuffer::cleanup();
96 SharedMemoryLookupTable::cleanup();
103 if ( (tmp = argp->
arg(
"l")) != NULL) {
104 if ( strchr(tmp,
'i') != NULL) {
105 SharedMemoryImageBuffer::list();
107 if ( strchr(tmp,
'l') != NULL) {
108 SharedMemoryLookupTable::list();
111 SharedMemoryImageBuffer::list();
112 SharedMemoryLookupTable::list();
120 SharedMemoryImageBuffer::list();
122 SharedMemoryLookupTable::list();
const char * arg(const char *argn)
Get argument value.
const std::vector< const char *> & items() const
Get non-option items.
Fawkes library namespace.
Parse command line arguments.
unsigned char * buffer() const
Get image buffer.
std::vector< const char *>::size_type num_items() const
Get number of non-option items.
FvRaw Writer implementation.
Base class for exceptions in Fawkes.
Shared memory image buffer.
virtual void write()
Write to file.
unsigned int width() const
Get image width.
void print_trace()
Prints trace to stderr.
bool has_arg(const char *argn)
Check if argument has been supplied.
unsigned int height() const
Get image height.
colorspace_t colorspace() const
Get color space.