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
26#include <cerrno>
27#include <cstdlib>
28#include <unistd.h>
29
30using namespace std;
31using namespace firevision;
32
33int
34main(int argc, char **argv)
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,
44 "File with name %s exists, delete manually and retry. Aborting.\n",
45 context_file);
46 return -1;
47 }
48 if (access(context_file, W_OK) != 0) {
49 // ENOENT is ok, we would have access, but there is no file, yet
50 if (errno != ENOENT) {
51 fprintf(stderr, "Cannot write to file %s, permission problem?\n", context_file);
52 return -2;
53 }
54 }
55
56 CameraArgumentParser *cap = new CameraArgumentParser("bumblebee2:Bumblebee2 BB2-03S2C");
57
58 Bumblebee2Camera *bb2 = new Bumblebee2Camera(cap);
59 bb2->open();
60
62 bb2->close();
63 delete bb2;
64 delete cap;
65
66 return 0;
67}
Bumblebee2 camera.
Definition: bumblebee2.h:35
virtual void close()
Close camera.
Definition: bumblebee2.cpp:393
virtual void open()
Open the camera.
Definition: bumblebee2.cpp:345
void write_triclops_config_from_camera_to_file(const char *filename)
Retrieve config from camera.
Definition: bumblebee2.cpp:572
Camera argument parser.
Definition: camargp.h:36