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 <cams/bumblebee2.h> 00024 #include <fvutils/system/camargp.h> 00025 #include <cerrno> 00026 #include <cstdlib> 00027 00028 using namespace std; 00029 using namespace firevision; 00030 00031 int 00032 main(int argc, char **argv) 00033 { 00034 00035 if ( argc < 2 ) { 00036 printf("Usage: %s <context_file>\n", argv[0]); 00037 exit(-1); 00038 } 00039 00040 const char *context_file = argv[1]; 00041 if ( access(context_file, F_OK) == 0) { 00042 fprintf(stderr, "File with name %s exists, delete manually and retry. Aborting.\n", context_file); 00043 return -1; 00044 } 00045 if ( access(context_file, W_OK) != 0) { 00046 // ENOENT is ok, we would have access, but there is no file, yet 00047 if ( errno != ENOENT ) { 00048 fprintf(stderr, "Cannot write to file %s, permission problem?\n", context_file); 00049 return -2; 00050 } 00051 } 00052 00053 CameraArgumentParser *cap = new CameraArgumentParser("bumblebee2:Bumblebee2 BB2-03S2C"); 00054 00055 Bumblebee2Camera *bb2 = new Bumblebee2Camera(cap); 00056 bb2->open(); 00057 00058 bb2->write_triclops_config_from_camera_to_file(context_file); 00059 bb2->close(); 00060 delete bb2; 00061 delete cap; 00062 00063 return 0; 00064 }