Fawkes API  Fawkes Development Version
bb2gettric.cpp
1 
2 /***************************************************************************
3  * bb2gettric.cpp - Get Triclops context from BB2 camera
4  *
5  * Created: Mon Oct 08 14:12:39 2007
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.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include <fvcams/bumblebee2.h>
24 #include <fvutils/system/camargp.h>
25 #include <cerrno>
26 #include <cstdlib>
27 #include <unistd.h>
28 
29 using namespace std;
30 using namespace firevision;
31 
32 int
33 main(int argc, char **argv)
34 {
35 
36  if ( argc < 2 ) {
37  printf("Usage: %s <context_file>\n", argv[0]);
38  exit(-1);
39  }
40 
41  const char *context_file = argv[1];
42  if ( access(context_file, F_OK) == 0) {
43  fprintf(stderr, "File with name %s exists, delete manually and retry. Aborting.\n", context_file);
44  return -1;
45  }
46  if ( access(context_file, W_OK) != 0) {
47  // ENOENT is ok, we would have access, but there is no file, yet
48  if ( errno != ENOENT ) {
49  fprintf(stderr, "Cannot write to file %s, permission problem?\n", context_file);
50  return -2;
51  }
52  }
53 
54  CameraArgumentParser *cap = new CameraArgumentParser("bumblebee2:Bumblebee2 BB2-03S2C");
55 
56  Bumblebee2Camera *bb2 = new Bumblebee2Camera(cap);
57  bb2->open();
58 
60  bb2->close();
61  delete bb2;
62  delete cap;
63 
64  return 0;
65 }
virtual void open()
Open the camera.
Definition: bumblebee2.cpp:353
void write_triclops_config_from_camera_to_file(const char *filename)
Retrieve config from camera.
Definition: bumblebee2.cpp:592
STL namespace.
Camera argument parser.
Definition: camargp.h:38
Bumblebee2 camera.
Definition: bumblebee2.h:37
virtual void close()
Close camera.
Definition: bumblebee2.cpp:400