Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * bb2gettric.cpp - Get Triclops context from BB2 camera 00004 * 00005 * Created: Mon Oct 08 14:12:39 2007 00006 * Copyright 2005-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #include <fvcams/bumblebee2.h> 00024 #include <fvutils/system/camargp.h> 00025 #include <cerrno> 00026 #include <cstdlib> 00027 #include <unistd.h> 00028 00029 using namespace std; 00030 using namespace firevision; 00031 00032 int 00033 main(int argc, char **argv) 00034 { 00035 00036 if ( argc < 2 ) { 00037 printf("Usage: %s <context_file>\n", argv[0]); 00038 exit(-1); 00039 } 00040 00041 const char *context_file = argv[1]; 00042 if ( access(context_file, F_OK) == 0) { 00043 fprintf(stderr, "File with name %s exists, delete manually and retry. Aborting.\n", context_file); 00044 return -1; 00045 } 00046 if ( access(context_file, W_OK) != 0) { 00047 // ENOENT is ok, we would have access, but there is no file, yet 00048 if ( errno != ENOENT ) { 00049 fprintf(stderr, "Cannot write to file %s, permission problem?\n", context_file); 00050 return -2; 00051 } 00052 } 00053 00054 CameraArgumentParser *cap = new CameraArgumentParser("bumblebee2:Bumblebee2 BB2-03S2C"); 00055 00056 Bumblebee2Camera *bb2 = new Bumblebee2Camera(cap); 00057 bb2->open(); 00058 00059 bb2->write_triclops_config_from_camera_to_file(context_file); 00060 bb2->close(); 00061 delete bb2; 00062 delete cap; 00063 00064 return 0; 00065 }