00001 /********************************************************************* 00002 * 00003 * Software License Agreement (BSD License) 00004 * 00005 * Copyright (c) 2012, Robert Bosch LLC. 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * * Neither the name of the Robert Bosch nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 *********************************************************************/ 00036 #ifndef __PHOTO_CAMERA__ 00037 #define __PHOTO_CAMERA__ 00038 00039 //#include <string> 00040 00041 #include <gphoto2/gphoto2-camera.h> 00042 #include <gphoto2/gphoto2-context.h> 00043 #include <gphoto2/gphoto2-setting.h> 00044 #include <gphoto2/gphoto2-filesys.h> 00045 00046 00047 #include "photo/photo_camera_list.hpp" 00048 #include "photo/photo_image.hpp" 00049 00050 class photo_camera 00051 { 00052 00053 public: 00054 enum photo_mode { DIRECT = 0, TO_FILE = 1 }; 00055 00056 private: 00057 Camera* camera_; 00058 GPContext *context_; 00059 GPPortInfo port_info_; 00060 CameraAbilities abilities_; 00061 enum photo_mode mode_; 00062 00063 00064 public: 00065 00066 photo_camera( void ); 00067 ~photo_camera( void ); 00068 00069 //* Create a gphoto_camera context and set reporting functions 00070 GPContext* photo_camera_create_context( void ); 00071 00072 00073 //* Open the 'n'th photo_camera in the list 00074 bool photo_camera_open( photo_camera_list* list, int n ); 00075 00076 //* Open a connection the photo_camera of 'model' on port 'port'. 00077 bool photo_camera_open( photo_camera_list* list, const std::string model_name, std::string port_name ); 00078 00079 //* Close the photo_camera 00080 bool photo_camera_close( void ); 00081 00082 00083 //* set a photo_camera parameter 00084 bool photo_camera_set_config( std::string param, std::string value ); 00085 00086 //* get a photo_camera parameter 00087 bool photo_camera_get_config( std::string, char** value); 00088 00089 //* capture an image 00090 bool photo_camera_capture( photo_image* image ); 00091 00092 //* capture an image to file 00093 bool photo_camera_capture_to_file( std::string filename ); 00094 00095 00096 00097 int photo_camera_find_widget_by_name( std::string param, CameraWidget **child, CameraWidget **rootconfig ); 00098 00099 private: 00100 bool photo_camera_check_toggle_value( std::string value_in, bool* value_out ); 00101 }; 00102 00103 00104 00105 #endif //__PHOTO_CAMERA__