├── .gitignore ├── .travis.yml ├── CHANGELOG.rst ├── CMakeLists.txt ├── calibrations ├── calibration_50-0503343289.yaml └── calibration_50-0503343290.yaml ├── cfg ├── AvtVimbaCamera.cfg └── AvtVimbaCameraStereo.cfg ├── cmake └── TargetArchitecture.cmake ├── include ├── VimbaC │ └── Include │ │ ├── VimbaC.h │ │ └── VmbCommonTypes.h ├── VimbaCPP │ ├── Include │ │ ├── AncillaryData.h │ │ ├── BasicLockable.h │ │ ├── Camera.h │ │ ├── Camera.hpp │ │ ├── EnumEntry.h │ │ ├── EnumEntry.hpp │ │ ├── Feature.h │ │ ├── Feature.hpp │ │ ├── FeatureContainer.h │ │ ├── FeatureContainer.hpp │ │ ├── FileLogger.h │ │ ├── Frame.h │ │ ├── ICameraFactory.h │ │ ├── ICameraListObserver.h │ │ ├── IFeatureObserver.h │ │ ├── IFrameObserver.h │ │ ├── IInterfaceListObserver.h │ │ ├── IRegisterDevice.h │ │ ├── Interface.h │ │ ├── Interface.hpp │ │ ├── LoggerDefines.h │ │ ├── Mutex.h │ │ ├── SharedPointer.h │ │ ├── SharedPointerDefines.h │ │ ├── SharedPointer_impl.h │ │ ├── UserLoggerDefines.h │ │ ├── UserSharedPointerDefines.h │ │ ├── VimbaCPP.h │ │ ├── VimbaCPPCommon.h │ │ ├── VimbaSystem.h │ │ └── VimbaSystem.hpp │ └── Source │ │ ├── AncillaryData.cpp │ │ ├── BaseFeature.cpp │ │ ├── BaseFeature.h │ │ ├── BasicLockable.cpp │ │ ├── BoolFeature.cpp │ │ ├── BoolFeature.h │ │ ├── Camera.cpp │ │ ├── Clock.cpp │ │ ├── Clock.h │ │ ├── CommandFeature.cpp │ │ ├── CommandFeature.h │ │ ├── Condition.cpp │ │ ├── Condition.h │ │ ├── ConditionHelper.cpp │ │ ├── ConditionHelper.h │ │ ├── DefaultCameraFactory.cpp │ │ ├── DefaultCameraFactory.h │ │ ├── EnumEntry.cpp │ │ ├── EnumFeature.cpp │ │ ├── EnumFeature.h │ │ ├── Feature.cpp │ │ ├── FeatureContainer.cpp │ │ ├── FileLogger.cpp │ │ ├── FloatFeature.cpp │ │ ├── FloatFeature.h │ │ ├── Frame.cpp │ │ ├── FrameHandler.cpp │ │ ├── FrameHandler.h │ │ ├── FrameImpl.h │ │ ├── Helper.h │ │ ├── IntFeature.cpp │ │ ├── IntFeature.h │ │ ├── Interface.cpp │ │ ├── Mutex.cpp │ │ ├── MutexGuard.cpp │ │ ├── MutexGuard.h │ │ ├── RawFeature.cpp │ │ ├── RawFeature.h │ │ ├── Semaphore.cpp │ │ ├── Semaphore.h │ │ ├── StringFeature.cpp │ │ ├── StringFeature.h │ │ ├── Version.h │ │ └── VimbaSystem.cpp └── avt_vimba_camera │ ├── avt_vimba_api.h │ ├── avt_vimba_camera.h │ ├── frame_observer.h │ ├── mono_camera.h │ ├── mono_camera_nodelet.h │ ├── stereo_camera.h │ ├── stereo_camera_nodelet.h │ ├── sync.h │ └── vimba_ros.h ├── launch ├── calibration.launch ├── mono_camera.launch ├── mono_camera_nodelet.launch ├── record.launch ├── stereo_camera_nodelet.launch ├── stereo_camera_one_node.launch └── stereo_camera_two_nodes.launch ├── lib ├── 32bit │ ├── libVimbaC.so │ └── libVimbaCPP.so ├── 64bit │ ├── libVimbaC.so │ └── libVimbaCPP.so ├── arm_32bit │ ├── libVimbaC.so │ └── libVimbaCPP.so └── arm_64bit │ ├── libVimbaC.so │ └── libVimbaCPP.so ├── package.xml ├── plugins.xml └── src ├── avt_vimba_camera.cpp ├── frame_observer.cpp ├── mono_camera.cpp ├── nodes ├── mono_camera_node.cpp ├── mono_camera_nodelet.cpp ├── stereo_camera_node.cpp ├── stereo_camera_nodelet.cpp └── sync_node.cpp ├── stereo_camera.cpp └── sync.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Specific files 2 | src/VimbaCPP/ 3 | 4 | # Build objects 5 | lib/ 6 | bin/ 7 | build/ 8 | docs/ 9 | 10 | # Auto generated code 11 | cfg/cpp/ 12 | cfg/*.cfgc 13 | msg_gen/ 14 | msg/lisp/ 15 | 16 | # CMake files 17 | CMakeCache.txt 18 | cmake_install.cmake 19 | CMakeFiles/ 20 | src/*/Makefile 21 | src/*/cmake_install.cmake 22 | src/*/CMakeFiles/ 23 | 24 | # Eclipse temporary files 25 | .cproject 26 | .project 27 | .pydevproject 28 | 29 | # ctags 30 | .tags* 31 | */.tags* 32 | 33 | 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Generic UWSim Travis Continuous Integration Configuration File 2 | # This config file for Travis CI utilizes ros-industrial/industrial_ci package. 3 | # For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst 4 | sudo: required 5 | services: 6 | - docker 7 | language: generic 8 | compiler: 9 | - gcc 10 | notifications: 11 | email: 12 | recipients: 13 | - gm130s@gmail.com 14 | env: 15 | matrix: 16 | - ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu 17 | - ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu 18 | - ROS_DISTRO="kinetic" PRERELEASE=true 19 | - ROS_DISTRO="lunar" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu 20 | - ROS_DISTRO="lunar" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu 21 | - ROS_DISTRO="lunar" PRERELEASE=true 22 | matrix: 23 | allow_failures: 24 | - env: ROS_DISTRO="kinetic" PRERELEASE=true 25 | - env: ROS_DISTRO="lunar" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu 26 | - env: ROS_DISTRO="lunar" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu 27 | - env: ROS_DISTRO="lunar" PRERELEASE=true 28 | install: 29 | - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config 30 | script: 31 | - .ci_config/travis.sh 32 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(avt_vimba_camera) 3 | 4 | find_package(catkin REQUIRED COMPONENTS 5 | #libvimba 6 | camera_info_manager 7 | diagnostic_updater 8 | dynamic_reconfigure 9 | image_geometry 10 | image_transport 11 | message_filters 12 | roscpp 13 | sensor_msgs 14 | std_msgs 15 | polled_camera 16 | nodelet 17 | ) 18 | 19 | #Get architecture 20 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") 21 | include(TargetArchitecture) 22 | target_architecture(ARCH) 23 | 24 | #add dynamic reconfigure api 25 | generate_dynamic_reconfigure_options( 26 | cfg/AvtVimbaCamera.cfg 27 | cfg/AvtVimbaCameraStereo.cfg 28 | ) 29 | 30 | catkin_package( 31 | INCLUDE_DIRS include 32 | CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_geometry image_transport roscpp sensor_msgs std_msgs polled_camera 33 | ) 34 | 35 | ########### 36 | ## Build ## 37 | ########### 38 | 39 | include_directories( 40 | #${libvimba_INCLUDE_DIRS} 41 | ${catkin_INCLUDE_DIRS} 42 | include 43 | ) 44 | 45 | # C++11 support 46 | include(CheckCXXCompilerFlag) 47 | CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) 48 | CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) 49 | if(COMPILER_SUPPORTS_CXX11) 50 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 51 | elseif(COMPILER_SUPPORTS_CXX0X) 52 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") 53 | else() 54 | message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") 55 | endif() 56 | 57 | function(add_dependencies_and_linkings arg) 58 | add_dependencies(${arg} 59 | ${PROJECT_NAME}_gencfg 60 | #${libvimba_EXPORTED_TARGETS} 61 | ) 62 | 63 | if("${ARCH}" STREQUAL i386) 64 | target_link_libraries(${arg} 65 | ${catkin_LIBRARIES} 66 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaC.so 67 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaCPP.so 68 | ) 69 | elseif("${ARCH}" STREQUAL x86_64) 70 | target_link_libraries(${arg} 71 | ${catkin_LIBRARIES} 72 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so 73 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so 74 | ) 75 | elseif("${ARCH}" STREQUAL armv7) 76 | target_link_libraries(${arg} 77 | ${catkin_LIBRARIES} 78 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so 79 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so 80 | ) 81 | elseif("${ARCH}" STREQUAL armv8) 82 | target_link_libraries(${arg} 83 | ${catkin_LIBRARIES} 84 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so 85 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so 86 | ) 87 | else() 88 | message(FATAL_ERROR "[libvimba]: Architecture ${ARCH} not suported. Exiting...") 89 | endif() 90 | endfunction(add_dependencies_and_linkings) 91 | 92 | add_executable(mono_camera_node 93 | src/nodes/mono_camera_node.cpp 94 | src/mono_camera.cpp 95 | src/avt_vimba_camera.cpp 96 | src/frame_observer.cpp 97 | ) 98 | 99 | add_dependencies_and_linkings(mono_camera_node) 100 | 101 | add_executable(stereo_camera_node 102 | src/nodes/stereo_camera_node.cpp 103 | src/stereo_camera.cpp 104 | src/avt_vimba_camera.cpp 105 | src/frame_observer.cpp 106 | ) 107 | 108 | add_dependencies_and_linkings(stereo_camera_node) 109 | 110 | add_executable(sync_node 111 | src/nodes/sync_node.cpp 112 | src/sync.cpp 113 | ) 114 | 115 | add_dependencies_and_linkings(sync_node) 116 | 117 | add_library(avt_camera_nodelets 118 | src/nodes/mono_camera_nodelet.cpp 119 | src/nodes/stereo_camera_nodelet.cpp 120 | src/stereo_camera.cpp 121 | src/avt_vimba_camera.cpp 122 | src/frame_observer.cpp) 123 | add_dependencies_and_linkings(avt_camera_nodelets) 124 | 125 | ############# 126 | ## Install ## 127 | ############# 128 | 129 | ## Mark executables and/or libraries for installation 130 | install(TARGETS mono_camera_node stereo_camera_node avt_camera_nodelets 131 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 132 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 133 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 134 | ) 135 | 136 | ## Mark cpp header files for installation 137 | install(DIRECTORY include 138 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 139 | FILES_MATCHING PATTERN "*.h" 140 | PATTERN ".svn" EXCLUDE 141 | ) 142 | 143 | ## Mark other files for installation (e.g. launch and bag files, etc.) 144 | install(FILES 145 | plugins.xml 146 | launch/mono_camera.launch 147 | launch/mono_camera_nodelet.launch 148 | launch/stereo_camera_one_node.launch 149 | launch/stereo_camera_two_nodes.launch 150 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 151 | ) 152 | 153 | install(DIRECTORY launch 154 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 155 | ) 156 | 157 | if("${ARCH}" STREQUAL i386) 158 | install(FILES 159 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaC.so 160 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/32bit/libVimbaCPP.so 161 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 162 | ) 163 | elseif("${ARCH}" STREQUAL x86_64) 164 | install(FILES 165 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so 166 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so 167 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 168 | ) 169 | elseif("${ARCH}" STREQUAL armv7) 170 | install(FILES 171 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so 172 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so 173 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 174 | ) 175 | elseif("${ARCH}" STREQUAL armv8) 176 | install(FILES 177 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so 178 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so 179 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 180 | ) 181 | endif() 182 | -------------------------------------------------------------------------------- /calibrations/calibration_50-0503343289.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1920 2 | image_height: 1440 3 | camera_name: left_optical 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [1477.37610504879, 0, 966.3836593155506, 0, 1470.959845844984, 721.682892292772, 0, 0, 1] 8 | distortion_model: rational_polynomial 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 8 12 | data: [0.1424740048592687, 2.048769427985746, 0.0008456231435827007, -0.0004816724796356829, -2.834810741450366, -0.1613802969459177, 1.425388415204544, -2.584546591478115] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [0.9905132663703519, -0.003683047506279885, 0.1373677702570837, 0.002297487443287912, 0.9999448926725898, 0.01024368925000131, -0.1373979282805399, -0.009830909371423568, 0.9904671435868766] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [2046.340398990372, 0, 720.5770225524902, 0, 0, 2046.340398990372, 710.3249855041504, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /calibrations/calibration_50-0503343290.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1920 2 | image_height: 1440 3 | camera_name: right_optical 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [1459.350261293599, 0, 936.395832784679, 0, 1454.523249372403, 693.0275372846803, 0, 0, 1] 8 | distortion_model: rational_polynomial 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 8 12 | data: [-0.06806374181729541, 1.727943254181413, -0.004167575721891483, -0.009607071635809723, 0.4727304262201982, -0.2948815842502582, 0.9950022654854973, 0.4526836378939169] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [0.9930299622595871, 0.01100923637391589, 0.1173468822303624, -0.009825965252955784, 0.9998949305886402, -0.01065730688241721, -0.1174518814730994, 0.009429978663897338, 0.9930338015600614] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [2046.340398990372, 0, 720.5770225524902, -297.3200476069327, 0, 2046.340398990372, 710.3249855041504, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /include/VimbaC/Include/VmbCommonTypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/include/VimbaC/Include/VmbCommonTypes.h -------------------------------------------------------------------------------- /include/VimbaCPP/Include/AncillaryData.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: AncillaryData.h 10 | 11 | Description: Definition of class AVT::VmbAPI::AncillaryData. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_ANCILLARYDATA_H 29 | #define AVT_VMBAPI_ANCILLARYDATA_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace AVT { 36 | namespace VmbAPI { 37 | 38 | class AncillaryData : public FeatureContainer 39 | { 40 | public: 41 | AncillaryData( VmbFrame_t *pFrame ); 42 | ~AncillaryData(); 43 | 44 | // 45 | // Method: Open() 46 | // 47 | // Purpose: Opens the ancillary data to allow access to the elements of the ancillary data via feature access. 48 | // 49 | // Returns: 50 | // 51 | // - VmbErrorSuccess: If no error 52 | // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command 53 | // 54 | // Details: This function can only succeed if the given frame has been filled by the API. 55 | // 56 | IMEXPORT VmbErrorType Open(); 57 | 58 | // 59 | // Method: Close() 60 | // 61 | // Purpose: Closes the ancillary data inside a frame. 62 | // 63 | // Returns: 64 | // 65 | // - VmbErrorSuccess: If no error 66 | // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command 67 | // - VmbErrorBadHandle: The given handle is not valid 68 | // 69 | // Details: After reading the ancillary data and before re-queuing the frame, ancillary data 70 | // must be closed. 71 | // 72 | IMEXPORT VmbError_t Close(); 73 | 74 | // 75 | // Method: GetBuffer() 76 | // 77 | // Purpose: Returns the underlying buffer 78 | // 79 | // Parameters: [out] VmbUchar_t*& pBuffer A pointer to the buffer 80 | // 81 | // Returns: 82 | // 83 | // - VmbErrorSuccess: If no error 84 | // 85 | IMEXPORT VmbErrorType GetBuffer( VmbUchar_t* &pBuffer ); 86 | 87 | // 88 | // Method: GetBuffer() 89 | // 90 | // Purpose: Returns the underlying buffer 91 | // 92 | // Parameters: [out] const VmbUchar_t*& pBuffer A pointer to the buffer 93 | // 94 | // Returns: 95 | // 96 | // - VmbErrorSuccess: If no error 97 | // 98 | IMEXPORT VmbErrorType GetBuffer( const VmbUchar_t* &pBuffer ) const; 99 | 100 | // 101 | // Method: GetSize() 102 | // 103 | // Purpose: Returns the size of the underlying buffer 104 | // 105 | // Parameters: [out] VmbUint32_t& size The size of the buffer 106 | // 107 | // Returns: 108 | // 109 | // - VmbErrorSuccess: If no error 110 | // 111 | IMEXPORT VmbErrorType GetSize( VmbUint32_t &size ) const; 112 | 113 | private: 114 | struct Impl; 115 | Impl *m_pImpl; 116 | 117 | // No default ctor 118 | AncillaryData(); 119 | // No copy ctor 120 | AncillaryData( const AncillaryData& ); 121 | // No assignment operator 122 | AncillaryData& operator=( const AncillaryData& ); 123 | }; 124 | 125 | }} // namespace AVT::VmbAPI 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/BasicLockable.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: BasicLockable.h 10 | 11 | Description: Definition of class AVT::VmbAPI::BasicLockable. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_BASICLOCKABLE 30 | #define AVT_VMBAPI_BASICLOCKABLE 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class BasicLockable 40 | { 41 | public: 42 | IMEXPORT BasicLockable(); 43 | IMEXPORT BasicLockable( MutexPtr pMutex ); 44 | 45 | IMEXPORT virtual ~BasicLockable(); 46 | 47 | MutexPtr GetMutex() const; 48 | 49 | void Lock() 50 | { 51 | SP_ACCESS(m_pMutex)->Lock(); 52 | } 53 | void Unlock() 54 | { 55 | SP_ACCESS(m_pMutex)->Unlock(); 56 | } 57 | private: 58 | MutexPtr m_pMutex; 59 | }; 60 | 61 | }} //namespace AVT::VmbAPI 62 | 63 | #endif -------------------------------------------------------------------------------- /include/VimbaCPP/Include/FeatureContainer.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FeatureContainer.h 10 | 11 | Description: Definition of class AVT::VmbAPI::FeatureContainer. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_FEATURECONTAINER_H 29 | #define AVT_VMBAPI_FEATURECONTAINER_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class FeatureContainer : public virtual BasicLockable 41 | { 42 | public: 43 | 44 | // 45 | // Method: FeatureContainer constructor 46 | // 47 | // Purpose: Creates an instance of class FeatureContainer 48 | // 49 | IMEXPORT FeatureContainer(); 50 | 51 | // 52 | // Method: FeatureContainer destructor 53 | // 54 | // Purpose: Destroys an instance of class FeatureContainer 55 | // 56 | IMEXPORT ~FeatureContainer(); 57 | 58 | // 59 | // Method: GetFeatureByName() 60 | // 61 | // Purpose: Gets one particular feature of a feature container (e.g. a camera) 62 | // 63 | // Parameters: 64 | // 65 | // [in ] const char* name The name of the feature to get 66 | // [out] FeaturePtr& pFeature The queried feature 67 | // 68 | // Returns: 69 | // 70 | // - VmbErrorSuccess: If no error 71 | // - VmbErrorDeviceNotOpen: Base feature class (e.g. Camera) was not opened. 72 | // - VmbErrorBadParameter: "name" is NULL. 73 | // 74 | IMEXPORT VmbErrorType GetFeatureByName( const char *pName, FeaturePtr &pFeature ); 75 | 76 | // 77 | // Method: GetFeatures() 78 | // 79 | // Purpose: Gets all features of a feature container (e.g. a camera) 80 | // 81 | // Parameters: 82 | // 83 | // [out] FeaturePtrVector& features The container for all queried features 84 | // 85 | // Returns: 86 | // 87 | // - VmbErrorSuccess: If no error 88 | // - VmbErrorBadParameter: "features" is empty. 89 | // 90 | // Details: Once queried, this information remains static throughout the object's lifetime 91 | // 92 | VmbErrorType GetFeatures( FeaturePtrVector &features ); 93 | 94 | VmbHandle_t GetHandle() const; 95 | 96 | protected: 97 | // Sets the C handle of a feature container 98 | void SetHandle( const VmbHandle_t handle ); 99 | 100 | // Sets the C handle of a feature container to NULL 101 | void RevokeHandle(); 102 | 103 | // Sets the back reference to feature container that each feature holds to NULL 104 | // and resets all known features 105 | void Reset(); 106 | 107 | private: 108 | struct Impl; 109 | Impl *m_pImpl; 110 | 111 | IMEXPORT VmbErrorType GetFeatures( FeaturePtr *pFeatures, VmbUint32_t &size ); 112 | 113 | // No copy ctor 114 | FeatureContainer( const FeatureContainer& ); 115 | // No assignment operator 116 | FeatureContainer& operator=( const FeatureContainer& ); 117 | }; 118 | 119 | #include 120 | 121 | }} // namespace AVT::VmbAPI 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/FeatureContainer.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FeatureContainer.hpp 10 | 11 | Description: Inline wrapper functions for class 12 | AVT::VmbAPI::FeatureContainer. 13 | (This include file is for internal use only.) 14 | 15 | ------------------------------------------------------------------------------- 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 19 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | =============================================================================*/ 29 | 30 | #ifndef AVT_VMBAPI_FEATURECONTAINER_HPP 31 | #define AVT_VMBAPI_FEATURECONTAINER_HPP 32 | 33 | // 34 | // Inline wrapper functions that allocate memory for STL objects in the application's context 35 | // and to pass data across DLL boundaries using arrays 36 | // 37 | 38 | // HINT: Once queried this information remains static throughout the object's lifetime 39 | inline VmbErrorType FeatureContainer::GetFeatures( FeaturePtrVector &features ) 40 | { 41 | VmbErrorType res; 42 | VmbUint32_t nSize; 43 | 44 | res = GetFeatures( NULL, nSize ); 45 | if ( VmbErrorSuccess == res ) 46 | { 47 | if( 0 != nSize) 48 | { 49 | try 50 | { 51 | FeaturePtrVector tmpFeatures( nSize ); 52 | res = GetFeatures( &tmpFeatures[0], nSize ); 53 | if( VmbErrorSuccess == res) 54 | { 55 | features.swap( tmpFeatures ); 56 | } 57 | } 58 | catch(...) 59 | { 60 | return VmbErrorResources; 61 | } 62 | } 63 | else 64 | { 65 | features.clear(); 66 | } 67 | } 68 | 69 | return res; 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/FileLogger.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FileLogger.h 10 | 11 | Description: Definition of class AVT::VmbAPI::FileLogger. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_FILELOGGER_H 29 | #define AVT_VMBAPI_FILELOGGER_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | namespace AVT { 39 | namespace VmbAPI { 40 | 41 | class FileLogger 42 | { 43 | public: 44 | FileLogger( const char *pFileName, bool append = true ); 45 | virtual ~FileLogger(); 46 | 47 | void Log( const std::string &StrMessage ); 48 | 49 | private: 50 | std::ofstream m_File; 51 | MutexPtr m_pMutex; 52 | 53 | std::string GetTempPath(); 54 | FileLogger( const FileLogger& ); 55 | FileLogger& operator=( const FileLogger& ); 56 | }; 57 | 58 | }} //namespace AVT:VmbAPI 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/ICameraFactory.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: ICameraFactory.h 10 | 11 | Description: Definition of interface AVT::VmbAPI::ICameraFactory. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_ICAMERAFACTORY_H 29 | #define AVT_VMBAPI_ICAMERAFACTORY_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class ICameraFactory 40 | { 41 | public: 42 | // 43 | // Method: CreateCamera() 44 | // 45 | // Purpose: Factory method to create a camera that extends the Camera class 46 | // 47 | // Parameters: 48 | // 49 | // [in ] const char* pCameraID The ID of the camera 50 | // [in ] const char* pCameraName The name of the camera 51 | // [in ] const char* pCameraModel The model name of the camera 52 | // [in ] const char* pCameraSerialNumber The serial number of the camera 53 | // [in ] const char* pInterfaceID The ID of the interface the camera is connected to 54 | // [in ] VmbInterfaceType interfaceType The type of the interface the camera is connected to 55 | // [in ] const char* pInterfaceName The name of the interface 56 | // [in ] const char* pInterfaceSerialNumber The serial number of the interface 57 | // [in ] VmbAccessModeType interfacePermittedAccess The access privileges for the interface 58 | // 59 | // Details: The ID of the camera may be, among others, one of the following: "169.254.12.13", 60 | // "000f31000001", a plain serial number: "1234567890", or the device ID 61 | // of the underlying transport layer. 62 | // 63 | IMEXPORT virtual CameraPtr CreateCamera( const char *pCameraID, 64 | const char *pCameraName, 65 | const char *pCameraModel, 66 | const char *pCameraSerialNumber, 67 | const char *pInterfaceID, 68 | VmbInterfaceType interfaceType, 69 | const char *pInterfaceName, 70 | const char *pInterfaceSerialNumber, 71 | VmbAccessModeType interfacePermittedAccess) = 0; 72 | 73 | // 74 | // Method: ICameraFactory destructor 75 | // 76 | // Purpose: Destroys an instance of class Camera 77 | // 78 | IMEXPORT virtual ~ICameraFactory() {} 79 | 80 | }; 81 | 82 | }} // namespace AVT::VmbAPI 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/ICameraListObserver.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: ICameraListObserver.h 10 | 11 | Description: Definition of interface AVT::VmbAPI::ICameraListObserver. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_ICAMERALISTOBSERVER_H 29 | #define AVT_VMBAPI_ICAMERALISTOBSERVER_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class ICameraListObserver 41 | { 42 | public: 43 | // 44 | // Method: CameraListChanged() 45 | // 46 | // Purpose: The event handler function that gets called whenever 47 | // an ICameraListObserver is triggered. This occurs most 48 | // likely when a camera was plugged in or out. 49 | // 50 | // Parameters: 51 | // 52 | // [out] CameraPtr pCam The camera that triggered the event 53 | // [out] UpdateTriggerType reason The reason why the callback routine was triggered 54 | // (e.g., a new camera was plugged in) 55 | // 56 | IMEXPORT virtual void CameraListChanged( CameraPtr pCam, UpdateTriggerType reason ) = 0; 57 | 58 | // 59 | // Method: ICameraListObserver destructor 60 | // 61 | // Purpose: Destroys an instance of class ICameraListObserver 62 | // 63 | IMEXPORT virtual ~ICameraListObserver() {} 64 | 65 | protected: 66 | IMEXPORT ICameraListObserver() { /*No default ctor*/ } 67 | IMEXPORT ICameraListObserver( const ICameraListObserver& ) { /* No copy ctor */ } 68 | }; 69 | typedef std::vector ICameraListObserverPtrVector; 70 | 71 | }} // namespace AVT::VmbAPI 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/IFeatureObserver.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: IFeatureObserver.h 10 | 11 | Description: Definition of interface AVT::VmbAPI::IFeatureObserver. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_IFEATUREOBSERVER_H 29 | #define AVT_VMBAPI_IFEATUREOBSERVER_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class IFeatureObserver 40 | { 41 | public: 42 | // 43 | // Method: FeatureChanged() 44 | // 45 | // Purpose: The event handler function that gets called whenever 46 | // a feature has changed 47 | // 48 | // Parameters: 49 | // 50 | // [in] const FeaturePtr& pFeature The frame that has changed 51 | // 52 | IMEXPORT virtual void FeatureChanged( const FeaturePtr &pFeature ) = 0; 53 | 54 | // 55 | // Method: IFeatureObserver destructor 56 | // 57 | // Purpose: Destroys an instance of class IFeatureObserver 58 | // 59 | IMEXPORT virtual ~IFeatureObserver() {} 60 | 61 | protected: 62 | IMEXPORT IFeatureObserver() {} 63 | IMEXPORT IFeatureObserver( const IFeatureObserver& ) { /* No copy ctor */ } 64 | }; 65 | typedef std::vector IFeatureObserverPtrVector; 66 | 67 | }} // namespace AVT::VmbAPI 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/IFrameObserver.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: IFrameObserver.h 10 | 11 | Description: Definition of interface AVT::VmbAPI::IFrameObserver. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_IFRAMEOBSERVER_H 29 | #define AVT_VMBAPI_IFRAMEOBSERVER_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace AVT { 36 | namespace VmbAPI { 37 | 38 | class IFrameObserver 39 | { 40 | public: 41 | // 42 | // Method: FrameReceived() 43 | // 44 | // Purpose: The event handler function that gets called whenever 45 | // a new frame is received 46 | // 47 | // Parameters: 48 | // 49 | // [in] const FramePtr pFrame The frame that was received 50 | // 51 | IMEXPORT virtual void FrameReceived( const FramePtr pFrame ) = 0; 52 | 53 | // 54 | // Method: IFrameObserver destructor 55 | // 56 | // Purpose: Destroys an instance of class IFrameObserver 57 | // 58 | IMEXPORT virtual ~IFrameObserver() {} 59 | 60 | protected: 61 | CameraPtr m_pCamera; 62 | IMEXPORT IFrameObserver( CameraPtr pCamera ) : m_pCamera( pCamera ) {} 63 | 64 | IMEXPORT IFrameObserver( IFrameObserver& ) { /* No copy ctor */ } 65 | 66 | private: 67 | IFrameObserver() { /* No default ctor */ } 68 | }; 69 | 70 | }} // namespace AVT::VmbAPI 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/IInterfaceListObserver.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: IInterfaceListObserver.h 10 | 11 | Description: Definition of interface AVT::VmbAPI::IInterfaceListObserver. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_IINTERFACELISTOBSERVER_H 29 | #define AVT_VMBAPI_IINTERFACELISTOBSERVER_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class IInterfaceListObserver 40 | { 41 | public: 42 | // 43 | // Method: InterfaceListChanged() 44 | // 45 | // Purpose: The event handler function that gets called whenever 46 | // an IInterfaceListObserver is triggered. 47 | // 48 | // Parameters: 49 | // 50 | // [out] InterfacePtr pInterface The interface that triggered the event 51 | // [out] UpdateTriggerType reason The reason why the callback routine was triggered 52 | // 53 | IMEXPORT virtual void InterfaceListChanged( InterfacePtr pInterface, UpdateTriggerType reason ) = 0; 54 | 55 | // 56 | // Method: IInterfaceListObserver destructor 57 | // 58 | // Purpose: Destroys an instance of class IInterfaceListObserver 59 | // 60 | IMEXPORT virtual ~IInterfaceListObserver() {} 61 | 62 | protected: 63 | IMEXPORT IInterfaceListObserver() {}; 64 | IMEXPORT IInterfaceListObserver( const IInterfaceListObserver& ) { /* No copy ctor */ } 65 | IMEXPORT IInterfaceListObserver& operator=( const IInterfaceListObserver& ) { /* No assignment operator */ return *this; } 66 | 67 | }; 68 | typedef std::vector IInterfaceListObserverPtrVector; 69 | 70 | }} // namespace AVT::VmbAPI 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/Interface.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Interface.hpp 10 | 11 | Description: Inline wrapper functions for class AVT::VmbAPI::Interface. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_INTERFACE_HPP 30 | #define AVT_VMBAPI_INTERFACE_HPP 31 | 32 | // 33 | // Inline wrapper functions that allocate memory for STL objects in the application's context 34 | // and to pass data across DLL boundaries using arrays 35 | // 36 | 37 | // HINT: This information remains static throughout the object's lifetime 38 | inline VmbErrorType Interface::GetID( std::string &rStrID ) const 39 | { 40 | VmbErrorType res; 41 | VmbUint32_t nLength; 42 | 43 | res = GetID( NULL, nLength ); 44 | if ( VmbErrorSuccess == res) 45 | { 46 | if( 0 != nLength) 47 | { 48 | try 49 | { 50 | std::vector tmpID( nLength + 1, '\0' ); 51 | res = GetID( &tmpID[0], nLength ); 52 | if( VmbErrorSuccess == res ) 53 | { 54 | rStrID = &*tmpID.begin(); 55 | } 56 | } 57 | catch(...) 58 | { 59 | return VmbErrorResources; 60 | } 61 | } 62 | else 63 | { 64 | rStrID.clear(); 65 | } 66 | } 67 | 68 | return res; 69 | } 70 | 71 | // HINT: This information remains static throughout the object's lifetime 72 | inline VmbErrorType Interface::GetName( std::string &rStrName ) const 73 | { 74 | VmbErrorType res; 75 | VmbUint32_t nLength; 76 | 77 | res = GetName( NULL, nLength ); 78 | if ( VmbErrorSuccess == res ) 79 | { 80 | if( 0 != nLength ) 81 | { 82 | try 83 | { 84 | std::vector tmpName( nLength + 1, '\0' ); 85 | res = GetName( &tmpName[0], nLength ); 86 | if( VmbErrorSuccess == res ) 87 | { 88 | rStrName = &*tmpName.begin(); 89 | } 90 | } 91 | catch(...) 92 | { 93 | return VmbErrorResources; 94 | } 95 | } 96 | else 97 | { 98 | rStrName.clear(); 99 | } 100 | } 101 | 102 | return res; 103 | } 104 | 105 | // HINT: This information remains static throughout the object's lifetime 106 | inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const 107 | { 108 | VmbErrorType res; 109 | VmbUint32_t nLength; 110 | 111 | res = GetSerialNumber( NULL, nLength ); 112 | if ( VmbErrorSuccess == res ) 113 | { 114 | if( 0 != nLength) 115 | { 116 | try 117 | { 118 | std::vector tmpSerial( nLength + 1, '\0'); 119 | res = GetSerialNumber( &tmpSerial[0], nLength ); 120 | if( VmbErrorSuccess == res ) 121 | { 122 | rStrSerial = &*tmpSerial.begin(); 123 | } 124 | } 125 | catch(...) 126 | { 127 | return VmbErrorResources; 128 | } 129 | } 130 | else 131 | { 132 | rStrSerial.clear(); 133 | } 134 | } 135 | 136 | return res; 137 | } 138 | 139 | #endif 140 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/LoggerDefines.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: LoggerDefines.h 10 | 11 | Description: Definition of macros for logging. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_LOGGERDEFINES_H 30 | #define AVT_VMBAPI_LOGGERDEFINES_H 31 | 32 | #include 33 | 34 | #ifndef USER_LOGGER 35 | 36 | #include 37 | 38 | namespace AVT { 39 | namespace VmbAPI { 40 | 41 | #define LOGGER_DECL FileLogger 42 | #define LOGGER_DEF FileLogger( "VimbaCPP.log", true ) 43 | #define LOGGER_LOG( logger, loggingInfo ) if ( NULL != (logger) ) (logger)->Log( loggingInfo ); 44 | 45 | 46 | // These are all uses of LOGGER_DECL logger declarations 47 | typedef LOGGER_DECL* Logger; 48 | 49 | }} 50 | 51 | #else 52 | #include 53 | #endif 54 | 55 | #include 56 | 57 | #define LOG_FREE_TEXT( txt ) std::string strExc( txt );\ 58 | strExc.append( " in function: " );\ 59 | strExc.append( __FUNCTION__ );\ 60 | LOGGER_LOG( VimbaSystem::GetInstance().GetLogger(), strExc ); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/Mutex.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Mutex.h 10 | 11 | Description: Definition of class AVT::VmbAPI::Mutex. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_MUTEX 30 | #define AVT_VMBAPI_MUTEX 31 | 32 | #include 33 | 34 | #ifdef _WIN32 35 | #include 36 | #else 37 | #include 38 | #endif 39 | 40 | namespace AVT { 41 | namespace VmbAPI { 42 | 43 | class Mutex 44 | { 45 | public: 46 | IMEXPORT explicit Mutex( bool bInitLock = false ); 47 | IMEXPORT ~Mutex(); 48 | 49 | IMEXPORT void Lock(); 50 | IMEXPORT void Unlock(); 51 | 52 | protected: 53 | #ifdef _WIN32 54 | HANDLE m_hMutex; 55 | #else 56 | pthread_mutex_t m_Mutex; 57 | #endif 58 | 59 | private: 60 | Mutex& operator=( const Mutex& ); 61 | Mutex( const Mutex& ); 62 | }; 63 | 64 | }} //namespace AVT::VmbAPI 65 | 66 | #endif //AVT_VMBAPI_MUTEX 67 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/SharedPointer.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: SharedPointer.h 10 | 11 | Description: Definition of an example shared pointer class that can be 12 | used with the Vimba CPP API. 13 | (This include file contains example code only.) 14 | 15 | ------------------------------------------------------------------------------- 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 19 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | =============================================================================*/ 29 | 30 | #ifndef AVT_VMBAPI_SHAREDPOINTER_H 31 | #define AVT_VMBAPI_SHAREDPOINTER_H 32 | 33 | #include 34 | 35 | namespace AVT { 36 | namespace VmbAPI { 37 | 38 | //Coding style of this file is different to mimic the shared_ptr classes of std and boost. 39 | 40 | struct dynamic_cast_tag 41 | { 42 | }; 43 | 44 | class ref_count_base 45 | { 46 | public: 47 | virtual ~ref_count_base() {;} 48 | 49 | virtual void inc() = 0; 50 | virtual void dec() = 0; 51 | virtual long use_count() const = 0; 52 | }; 53 | 54 | template 55 | class ref_count : public virtual AVT::VmbAPI::ref_count_base 56 | { 57 | private: 58 | T *m_pObject; 59 | long m_nCount; 60 | Mutex m_Mutex; 61 | 62 | ref_count(const ref_count &rRefCount); 63 | ref_count& operator = (const ref_count &rRefCount); 64 | 65 | public: 66 | explicit ref_count(T *pObject); 67 | virtual ~ref_count(); 68 | 69 | virtual void inc(); 70 | virtual void dec(); 71 | virtual long use_count() const; 72 | }; 73 | 74 | template 75 | class shared_ptr 76 | { 77 | private: 78 | typedef shared_ptr this_type; 79 | 80 | template 81 | friend class shared_ptr; 82 | 83 | AVT::VmbAPI::ref_count_base *m_pRefCount; 84 | T *m_pObject; 85 | 86 | template 87 | static void swap(T2 &rValue1, T2 &rValue2); 88 | 89 | public: 90 | shared_ptr(); 91 | template 92 | explicit shared_ptr(T2 *pObject); 93 | shared_ptr(const shared_ptr &rSharedPointer); 94 | template 95 | shared_ptr(const shared_ptr &rSharedPointer); 96 | template 97 | shared_ptr(const shared_ptr &rSharedPointer, dynamic_cast_tag); 98 | 99 | virtual ~shared_ptr(); 100 | 101 | shared_ptr& operator = (const shared_ptr &rSharedPointer); 102 | template 103 | shared_ptr& operator = (const shared_ptr &rSharedPointer); 104 | 105 | void reset(); 106 | template 107 | void reset(T2 *pObject); 108 | 109 | T* get() const; 110 | T& operator * () const; 111 | T* operator -> () const; 112 | long use_count() const; 113 | bool unique() const; 114 | 115 | typedef T* this_type::*unspecified_bool_type; 116 | 117 | operator unspecified_bool_type () const 118 | { 119 | if(m_pObject == 0) 120 | { 121 | return 0; 122 | } 123 | 124 | return &this_type::m_pObject; 125 | } 126 | 127 | void swap(shared_ptr &rSharedPointer); 128 | }; 129 | 130 | template 131 | shared_ptr dynamic_pointer_cast(const shared_ptr &rSharedPointer); 132 | 133 | template 134 | bool operator==(const shared_ptr& sp1, const shared_ptr& sp2); 135 | template 136 | bool operator!=(const shared_ptr& sp1, const shared_ptr& sp2); 137 | 138 | }} //namespace AVT::VmbAPI 139 | 140 | #include 141 | 142 | #endif //AVT_VMBAPI_SHAREDPOINTER_H 143 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/SharedPointerDefines.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: SharedPointerDefines.h 10 | 11 | Description: Definition of macros for using the standard shared pointer 12 | (std::tr1) for Vimba CPP API. 13 | (This include file is for internal use only.) 14 | 15 | ------------------------------------------------------------------------------- 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 19 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | =============================================================================*/ 29 | 30 | #ifndef AVT_VMBAPI_SHAREDPOINTERDEFINES_H 31 | #define AVT_VMBAPI_SHAREDPOINTERDEFINES_H 32 | 33 | // 34 | // If your version of STL does not provide a shared pointer implementation please see UserSharedPointerDefines.h for information on 35 | // how to use another shared pointer than std::shared_ptr. 36 | // 37 | 38 | #ifndef USER_SHARED_POINTER 39 | 40 | #include 41 | 42 | namespace AVT { 43 | namespace VmbAPI { 44 | 45 | #define SP_DECL( T ) AVT::VmbAPI::shared_ptr 46 | #define SP_SET( sp, rawPtr ) (sp).reset( (rawPtr) ) 47 | #define SP_RESET( sp ) (sp).reset() 48 | #define SP_ISEQUAL( sp1, sp2 ) ( (sp1) == (sp2) ) 49 | #define SP_ISNULL( sp ) ( NULL == (sp) ) 50 | #define SP_ACCESS( sp ) (sp).get() 51 | #define SP_DYN_CAST( sp, T ) AVT::VmbAPI::dynamic_pointer_cast(sp) 52 | 53 | // These are all uses of a SP_DECL shared_ptr declaration 54 | class Interface; 55 | typedef SP_DECL( Interface ) InterfacePtr; 56 | 57 | class Camera; 58 | typedef SP_DECL( Camera ) CameraPtr; 59 | 60 | class Feature; 61 | typedef SP_DECL( Feature ) FeaturePtr; 62 | 63 | class FeatureContainer; 64 | typedef SP_DECL( FeatureContainer ) FeatureContainerPtr; 65 | 66 | class IFeatureObserver; 67 | typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr; 68 | 69 | class Frame; 70 | typedef SP_DECL( Frame ) FramePtr; 71 | 72 | class FrameHandler; 73 | typedef SP_DECL( FrameHandler ) FrameHandlerPtr; 74 | 75 | class IFrameObserver; 76 | typedef SP_DECL( IFrameObserver ) IFrameObserverPtr; 77 | 78 | class AncillaryData; 79 | typedef SP_DECL( AncillaryData ) AncillaryDataPtr; 80 | typedef SP_DECL( const AncillaryData ) ConstAncillaryDataPtr; 81 | 82 | class ICameraFactory; 83 | typedef SP_DECL( ICameraFactory ) ICameraFactoryPtr; 84 | 85 | class ICameraListObserver; 86 | typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr; 87 | 88 | class IInterfaceListObserver; 89 | typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr; 90 | 91 | class Mutex; 92 | typedef SP_DECL( Mutex ) MutexPtr; 93 | 94 | class BasicLockable; 95 | typedef SP_DECL( BasicLockable ) BasicLockablePtr; 96 | 97 | }} 98 | 99 | #else 100 | #include 101 | #endif 102 | 103 | 104 | #endif // AVT_VMBAPI_SHAREDPOINTERDEFINES_H 105 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/UserLoggerDefines.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: UserLoggerDefines.h 10 | 11 | Description: Definition of macros used for different logging methods. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_USERLOGGERDEFINES_H 29 | #define AVT_VMBAPI_USERLOGGERDEFINES_H 30 | 31 | // 32 | // To use your own logger implementation add the define USER_LOGGER to your project / compiler settings and complete this header file. 33 | // 34 | 35 | // Add all your required logger implementation headers here. 36 | // HINT: #include is an example and can be safely removed. 37 | #include 38 | 39 | namespace AVT { 40 | namespace VmbAPI { 41 | 42 | #define LOGGER_DECL FileLogger 43 | #define LOGGER_DEF FileLogger( "VimbaCPP.log", true ) 44 | #define LOGGER_LOG( logger, loggingInfo ) if ( NULL != (logger) ) (logger)->Log( loggingInfo ); 45 | 46 | 47 | // These are all uses of LOGGER_DECL logger declarations 48 | typedef LOGGER_DECL* Logger; 49 | 50 | }} // namespace AVT::VmbAPI 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/UserSharedPointerDefines.h: -------------------------------------------------------------------------------- 1 | #ifndef AVT_VMBAPI_USERSHAREDPOINTER_H 2 | #define AVT_VMBAPI_USERSHAREDPOINTER_H 3 | 4 | #include "..\..\..\..\VimbaNET\Include\NetPointer.h" 5 | 6 | namespace AVT { 7 | namespace VmbAPINET { 8 | 9 | ref class Camera; 10 | ref class Interface; 11 | ref class Frame; 12 | ref class Feature; 13 | ref class AncillaryData; 14 | 15 | }; 16 | }; 17 | 18 | namespace AVT { 19 | namespace VmbAPI { 20 | 21 | // Set the calls for your implementation of the shared pointer functions 22 | // a) Declaration 23 | // b) Reset with argument 24 | // c) Reset without argument 25 | // d) == operator 26 | // e) NULL test 27 | // f) Access to underlying raw pointer 28 | 29 | // a) This is the define for a declaration. 30 | #define SP_DECL( T ) NetPointer 31 | // b) This is the define for setting an existing shared pointer. 32 | #define SP_SET( sp, rawPtr ) sp.Reset( rawPtr ) 33 | // c) This is the define for resetting without an argument to decrease the ref count. 34 | #define SP_RESET( sp ) sp.Reset() 35 | // d) This is the define for the equal operator. Shared pointers are usually considered equal when the raw pointers point to the same address. 36 | #define SP_ISEQUAL( sp1, sp2 ) sp1.IsEqualTo(sp2) 37 | // e) This is the define for the NULL check. 38 | #define SP_ISNULL( sp ) sp.IsNull() 39 | // f) This is the define for the raw pointer access. This is usually accomplished through the dereferencing operator (->). 40 | #define SP_ACCESS( sp ) sp.AccessNative() 41 | 42 | class Camera; 43 | typedef NetPointer CameraPtr; 44 | 45 | class Interface; 46 | typedef NetPointer InterfacePtr; 47 | 48 | class Feature; 49 | typedef NetPointer FeaturePtr; 50 | 51 | class FeatureContainer; 52 | typedef SP_DECL( FeatureContainer ) FeatureContainerPtr; 53 | 54 | class IFeatureObserver; 55 | typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr; 56 | 57 | class Frame; 58 | typedef NetPointer FramePtr; 59 | 60 | class FrameHandler; 61 | typedef SP_DECL( FrameHandler ) FrameHandlerPtr; 62 | 63 | class IFrameObserver; 64 | typedef SP_DECL( IFrameObserver ) IFrameObserverPtr; 65 | 66 | class AncillaryData; 67 | typedef NetPointer AncillaryDataPtr; 68 | typedef NetPointer ConstAncillaryDataPtr; 69 | 70 | class ICameraFactory; 71 | typedef SP_DECL( ICameraFactory) ICameraFactoryPtr; 72 | 73 | class IInterfaceListObserver; 74 | typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr; 75 | 76 | class ICameraListObserver; 77 | typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr; 78 | 79 | class Mutex; 80 | typedef SP_DECL( Mutex ) MutexPtr; 81 | 82 | class BasicLockable; 83 | typedef SP_DECL( BasicLockable ) BasicLockablePtr; 84 | 85 | }} 86 | 87 | #include "..\..\..\..\VimbaNET\Include\NetCamera.h" 88 | #include "..\..\..\..\VimbaNET\Include\NetInterface.h" 89 | #include "..\..\..\..\VimbaNET\Include\NetFrame.h" 90 | #include "..\..\..\..\VimbaNET\Include\NetFeature.h" 91 | #include "..\..\..\..\VimbaNET\Include\NetAncillaryData.h" 92 | 93 | #endif /* AVT_VMBAPI_USERSHAREDPOINTER_H */ 94 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/VimbaCPP.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: VimbaCPP.h 10 | 11 | Description: Main include file for Vimba CPP API. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/VimbaCPPCommon.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: VimbaCPPCommon.h 10 | 11 | Description: Common type definitions used in Vimba CPP API. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_CPPCOMMON_H 29 | #define AVT_VMBAPI_CPPCOMMON_H 30 | 31 | #if defined (_WIN32) 32 | #if defined AVT_VMBAPI_CPP_EXPORTS // DLL exports 33 | #define IMEXPORT __declspec(dllexport) 34 | #elif defined AVT_VMBAPI_CPP_LIB // static LIB 35 | #define IMEXPORT 36 | #else // import 37 | #define IMEXPORT __declspec(dllimport) 38 | #endif 39 | #elif defined (__GNUC__) && (__GNUC__ >= 4) && defined (__ELF__) 40 | #define IMEXPORT 41 | #elif defined (__APPLE__) 42 | #define IMEXPORT 43 | #else 44 | #error Unknown platform, file needs adaption 45 | #endif 46 | 47 | #include 48 | #include 49 | #include "VimbaC/Include/VmbCommonTypes.h" 50 | 51 | namespace AVT { 52 | namespace VmbAPI { 53 | 54 | enum UpdateTriggerType 55 | { 56 | UpdateTriggerPluggedIn = 0, 57 | UpdateTriggerPluggedOut = 1, 58 | UpdateTriggerOpenStateChanged = 3 59 | }; 60 | 61 | typedef std::vector Uint64Vector; 62 | typedef std::vector Int64Vector; 63 | typedef std::vector UcharVector; 64 | typedef std::vector StringVector; 65 | class EnumEntry; 66 | typedef std::vector EnumEntryVector; 67 | 68 | }} // AVT::VmbAPI 69 | 70 | #endif -------------------------------------------------------------------------------- /include/VimbaCPP/Include/VimbaSystem.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ----------------------------------------------------------------------------- 8 | 9 | File: VimbaSystem.hpp 10 | 11 | Description: Inline wrapper functions for class AVT::VmbAPI::VimbaSystem. 12 | (This include file is for internal use only.) 13 | 14 | ----------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_VIMBASYSTEM_HPP 30 | #define AVT_VMBAPI_VIMBASYSTEM_HPP 31 | 32 | // 33 | // Inline wrapper functions that allocate memory for STL objects in the application's context 34 | // and to pass data across DLL boundaries using arrays 35 | // 36 | inline VmbErrorType VimbaSystem::GetInterfaces( InterfacePtrVector &rInterfaces ) 37 | { 38 | VmbErrorType res; 39 | VmbUint32_t nSize; 40 | 41 | res = GetInterfaces( NULL, nSize ); 42 | if ( VmbErrorSuccess == res ) 43 | { 44 | if( 0 != nSize) 45 | { 46 | try 47 | { 48 | InterfacePtrVector tmpInterfaces( nSize ); 49 | res = GetInterfaces( &tmpInterfaces[0], nSize ); 50 | if( VmbErrorSuccess == res ) 51 | { 52 | rInterfaces.swap( tmpInterfaces); 53 | } 54 | } 55 | catch(...) 56 | { 57 | return VmbErrorResources; 58 | } 59 | } 60 | else 61 | { 62 | rInterfaces.clear(); 63 | } 64 | } 65 | 66 | return res; 67 | } 68 | 69 | inline VmbErrorType VimbaSystem::GetCameras( CameraPtrVector &rCameras ) 70 | { 71 | VmbErrorType res; 72 | VmbUint32_t nSize; 73 | 74 | res = GetCameras( NULL, nSize ); 75 | if ( VmbErrorSuccess == res) 76 | { 77 | if( 0 != nSize) 78 | { 79 | try 80 | { 81 | CameraPtrVector tmpCameras( nSize ); 82 | res = GetCameras( &tmpCameras[0], nSize ); 83 | if( VmbErrorSuccess == res ) 84 | { 85 | rCameras.swap( tmpCameras ); 86 | } 87 | } 88 | catch(...) 89 | { 90 | return VmbErrorResources; 91 | } 92 | } 93 | else 94 | { 95 | rCameras.clear(); 96 | } 97 | } 98 | 99 | return res; 100 | } 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/AncillaryData.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: AncillaryData.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::AncillaryData. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #include 29 | 30 | #define IMAGE_CHUNK_TRAILER_LENGTH 8 31 | 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | struct AncillaryData::Impl 37 | { 38 | VmbFrame_t *m_pFrame; 39 | }; 40 | 41 | AncillaryData::AncillaryData() 42 | { 43 | // No default ctor 44 | } 45 | 46 | AncillaryData::AncillaryData( const AncillaryData& ) 47 | { 48 | // No copy ctor 49 | } 50 | 51 | AncillaryData& AncillaryData::operator=( const AncillaryData& ) 52 | { 53 | // No assignment operator 54 | return *this; 55 | } 56 | 57 | AncillaryData::AncillaryData( VmbFrame_t *pFrame ) 58 | : m_pImpl( new Impl() ) 59 | { 60 | m_pImpl->m_pFrame = pFrame; 61 | } 62 | 63 | AncillaryData::~AncillaryData() 64 | { 65 | delete m_pImpl; 66 | } 67 | 68 | VmbErrorType AncillaryData::GetBuffer( VmbUchar_t* &rpValue ) 69 | { 70 | VmbErrorType result = VmbErrorNotSupported; 71 | 72 | if (m_pImpl->m_pFrame->ancillarySize > 0) 73 | { 74 | rpValue = (VmbUchar_t*)m_pImpl->m_pFrame->buffer + m_pImpl->m_pFrame->imageSize + IMAGE_CHUNK_TRAILER_LENGTH; 75 | result = VmbErrorSuccess; 76 | } 77 | 78 | return result; 79 | } 80 | 81 | VmbErrorType AncillaryData::GetBuffer( const VmbUchar_t* &rpValue ) const 82 | { 83 | VmbErrorType result = VmbErrorNotSupported; 84 | 85 | if (m_pImpl->m_pFrame->ancillarySize > 0) 86 | { 87 | rpValue = (VmbUchar_t*)m_pImpl->m_pFrame->buffer + m_pImpl->m_pFrame->imageSize + IMAGE_CHUNK_TRAILER_LENGTH; 88 | result = VmbErrorSuccess; 89 | } 90 | 91 | return result; 92 | } 93 | 94 | VmbErrorType AncillaryData::GetSize( VmbUint32_t &nSize ) const 95 | { 96 | nSize = m_pImpl->m_pFrame->ancillarySize; 97 | 98 | return VmbErrorSuccess; 99 | } 100 | 101 | VmbErrorType AncillaryData::Open() 102 | { 103 | VmbError_t res; 104 | VmbHandle_t hHandle; 105 | 106 | res = VmbAncillaryDataOpen( m_pImpl->m_pFrame, &hHandle ); 107 | 108 | if ( VmbErrorSuccess == res ) 109 | { 110 | SetHandle( hHandle ); 111 | } 112 | 113 | return (VmbErrorType)res; 114 | } 115 | 116 | VmbError_t AncillaryData::Close() 117 | { 118 | VmbError_t res = VmbErrorSuccess; 119 | 120 | res = VmbAncillaryDataClose( GetHandle() ); 121 | 122 | Reset(); 123 | 124 | RevokeHandle(); 125 | 126 | return (VmbErrorType)res; 127 | } 128 | 129 | }} // namespace AVT::VmbAPI 130 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/BasicLockable.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: BasicLockable.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::BasicLockable. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | #include 31 | 32 | namespace AVT { 33 | namespace VmbAPI { 34 | 35 | BasicLockable::BasicLockable() 36 | : m_pMutex( MutexPtr( new Mutex() )) 37 | { 38 | } 39 | 40 | BasicLockable::~BasicLockable() 41 | { 42 | } 43 | 44 | BasicLockable::BasicLockable( MutexPtr pMutex ) 45 | : m_pMutex( pMutex ) 46 | { 47 | } 48 | 49 | MutexPtr BasicLockable::GetMutex() const 50 | { 51 | return m_pMutex; 52 | } 53 | 54 | }} //namespace AVT::VmbAPI 55 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/BoolFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: BoolFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::BoolFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | BoolFeature::BoolFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ) 35 | : BaseFeature( featureInfo, pFeatureContainer ) 36 | {} 37 | 38 | VmbErrorType BoolFeature::GetValue( bool &rbValue ) const 39 | { 40 | if ( NULL == m_pFeatureContainer ) 41 | { 42 | return VmbErrorDeviceNotOpen; 43 | } 44 | 45 | return (VmbErrorType)VmbFeatureBoolGet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rbValue ); 46 | } 47 | 48 | VmbErrorType BoolFeature::SetValue( bool bValue ) 49 | { 50 | if ( NULL == m_pFeatureContainer ) 51 | { 52 | return VmbErrorDeviceNotOpen; 53 | } 54 | 55 | return (VmbErrorType)VmbFeatureBoolSet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), bValue ); 56 | } 57 | 58 | }} // namespace AVT::VmbAPI 59 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/BoolFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: BoolFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::BoolFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_BOOLFEATURE_H 30 | #define AVT_VMBAPI_BOOLFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class BoolFeature : public BaseFeature 41 | { 42 | public: 43 | BoolFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ); 44 | 45 | // 46 | // Method: GetValue() 47 | // Purpose: Get the value of a boolean feature 48 | // Parameters: 49 | // [out] bool& value bool value 50 | // Returns: 51 | // - VmbErrorSuccess: If no error 52 | // - VmbErrorWrongType: Feature is not a bool feature 53 | // - VmbInternalError: Value could not get queried 54 | // 55 | IMEXPORT virtual VmbErrorType GetValue( bool &value ) const; 56 | 57 | // 58 | // Method: SetValue() 59 | // Purpose: Set the value of a boolean feature 60 | // 61 | IMEXPORT virtual VmbErrorType SetValue( bool value ); 62 | }; 63 | 64 | }} // namespace AVT::VmbAPI 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Clock.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Clock.cpp 10 | 11 | Description: Implementation of a platform independent Sleep. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifdef WIN32 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #include 38 | 39 | namespace AVT { 40 | namespace VmbAPI { 41 | 42 | Clock::Clock() 43 | : m_dStartTime(0.0) 44 | { 45 | } 46 | 47 | Clock::~Clock() 48 | { 49 | } 50 | 51 | void Clock::Reset() 52 | { 53 | m_dStartTime = 0.0; 54 | } 55 | 56 | void Clock::SetStartTime() 57 | { 58 | m_dStartTime = GetAbsTime(); 59 | } 60 | 61 | void Clock::SetStartTime( double dStartTime ) 62 | { 63 | m_dStartTime = dStartTime; 64 | } 65 | 66 | double Clock::GetTime() const 67 | { 68 | double dTime = 0.0; 69 | 70 | #ifdef WIN32 71 | _timeb currSysTime; 72 | 73 | _ftime_s(&currSysTime); 74 | 75 | dTime = (currSysTime.time + ((double)currSysTime.millitm) / 1000.0); 76 | #else 77 | timeval now; 78 | 79 | if(gettimeofday(&now, (struct timezone *)0)) return 0.0; 80 | 81 | dTime = ((double)now.tv_sec) + ((double)(now.tv_usec) / 1000000.0); 82 | #endif 83 | 84 | return dTime - m_dStartTime; 85 | } 86 | 87 | double Clock::GetAbsTime() 88 | { 89 | double dAbsTime = 0.0; 90 | 91 | #ifdef WIN32 92 | _timeb currSysTime; 93 | 94 | _ftime_s(&currSysTime); 95 | 96 | dAbsTime = (currSysTime.time + ((double)currSysTime.millitm) / 1000.0); 97 | #else 98 | timeval now; 99 | 100 | if(gettimeofday(&now, (struct timezone *)0)) return 0.0; 101 | 102 | dAbsTime = ((double)now.tv_sec) + ((double)(now.tv_usec) / 1000000.0); 103 | #endif 104 | 105 | return dAbsTime; 106 | } 107 | 108 | void Clock::Sleep(double dTime) 109 | { 110 | #ifdef WIN32 111 | ::Sleep((unsigned long)(dTime * 1000.0)); 112 | #else 113 | ::usleep((unsigned long)(dTime * 1000000.0)); 114 | #endif 115 | } 116 | 117 | void Clock::SleepMS(unsigned long nTimeMS) 118 | { 119 | #ifdef WIN32 120 | ::Sleep(nTimeMS); 121 | #else 122 | ::usleep(nTimeMS * 1000); 123 | #endif 124 | } 125 | 126 | void Clock::SleepAbs(double dAbsTime) 127 | { 128 | Clock clock; 129 | double dTimeDiff = dAbsTime - clock.GetTime(); 130 | 131 | #ifdef WIN32 132 | if(dTimeDiff > 4000000.0) dTimeDiff = 4000000.0; 133 | #else 134 | if(dTimeDiff >= 4000.0) dTimeDiff = 4000.0; 135 | #endif 136 | while(dTimeDiff > 0.0) 137 | { 138 | Sleep(dTimeDiff); 139 | dTimeDiff = dAbsTime - clock.GetTime(); 140 | #ifdef WIN32 141 | if(dTimeDiff > 4000000.0) dTimeDiff = 4000000.0; 142 | #else 143 | if(dTimeDiff >= 4000.0) dTimeDiff = 4000.0; 144 | #endif 145 | } 146 | } 147 | 148 | }} //namespace AVT::VmbAPI 149 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Clock.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Clock.h 10 | 11 | Description: Definition of a platform independent Sleep. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_CLOCK 30 | #define AVT_VMBAPI_CLOCK 31 | 32 | namespace AVT { 33 | namespace VmbAPI { 34 | 35 | class Clock 36 | { 37 | public: 38 | Clock(); 39 | virtual ~Clock(); 40 | 41 | virtual void Reset(); 42 | virtual void SetStartTime(); 43 | virtual void SetStartTime( double dStartTime ); 44 | virtual double GetTime() const; 45 | 46 | static double GetAbsTime(); 47 | 48 | static void Sleep( double dTime ); 49 | static void SleepMS( unsigned long nTimeMS ); 50 | static void SleepAbs( double dAbsTime ); 51 | 52 | protected: 53 | double m_dStartTime; 54 | }; 55 | 56 | }} //namespace AVT::VmbAPI 57 | 58 | #endif //AVT_VMBAPI_CLOCK 59 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/CommandFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: CommandFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::CommandFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | CommandFeature::CommandFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer *pFeatureContainer ) 35 | :BaseFeature( featureInfo, pFeatureContainer ) 36 | { 37 | } 38 | 39 | VmbErrorType CommandFeature::RunCommand() 40 | { 41 | if ( NULL == m_pFeatureContainer ) 42 | { 43 | return VmbErrorDeviceNotOpen; 44 | } 45 | 46 | return (VmbErrorType)VmbFeatureCommandRun( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str() ); 47 | } 48 | 49 | VmbErrorType CommandFeature::IsCommandDone( bool &rbIsDone ) const 50 | { 51 | if ( NULL == m_pFeatureContainer ) 52 | { 53 | return VmbErrorDeviceNotOpen; 54 | } 55 | 56 | return (VmbErrorType)VmbFeatureCommandIsDone( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rbIsDone ); 57 | } 58 | 59 | 60 | }} // namespace AVT::VmbAPI 61 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/CommandFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: CommandFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::CommandFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_COMMANDFEATURE_H 30 | #define AVT_VMBAPI_COMMANDFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class CommandFeature : public BaseFeature 41 | { 42 | public: 43 | CommandFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer *pFeatureContainer ); 44 | 45 | IMEXPORT virtual VmbErrorType RunCommand(); 46 | 47 | IMEXPORT virtual VmbErrorType IsCommandDone( bool & isDone ) const; 48 | }; 49 | 50 | }} // namespace AVT::VmbAPI 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Condition.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Condition.cpp 10 | 11 | Description: Implementation of a condition class. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | Condition::Condition() 35 | : m_nWaiterNumber( 0 ) 36 | , m_nReleaseNumber( 0 ) 37 | , m_bLocked( true ) 38 | { 39 | SP_SET( m_Semaphore, new Semaphore() ); 40 | } 41 | 42 | void Condition::Wait( const BasicLockable &rLockable ) 43 | { 44 | Wait( rLockable.GetMutex() ); 45 | } 46 | 47 | void Condition::Wait( const MutexPtr &rMutex ) 48 | { 49 | m_nWaiterNumber++; 50 | 51 | SP_ACCESS( rMutex )->Unlock(); 52 | 53 | SP_ACCESS( m_Semaphore )->Acquire(); 54 | 55 | SP_ACCESS( rMutex) ->Lock(); 56 | 57 | if ( m_nWaiterNumber > 0 ) 58 | { 59 | m_nWaiterNumber--; 60 | } 61 | 62 | if ( m_nReleaseNumber > 0 ) 63 | { 64 | m_nReleaseNumber--; 65 | } 66 | 67 | if( m_nWaiterNumber > 0 68 | && m_nReleaseNumber > 0 ) 69 | { 70 | SP_ACCESS( m_Semaphore )->Release(); 71 | m_bLocked = false; 72 | } 73 | else 74 | { 75 | m_bLocked = true; 76 | } 77 | 78 | if( m_nReleaseNumber > m_nWaiterNumber ) 79 | { 80 | m_nReleaseNumber = m_nWaiterNumber; 81 | } 82 | } 83 | 84 | void Condition::Signal( bool bSingle ) 85 | { 86 | if( m_nWaiterNumber > m_nReleaseNumber ) 87 | { 88 | if( true == bSingle ) 89 | { 90 | m_nReleaseNumber++; 91 | } 92 | else 93 | { 94 | m_nReleaseNumber = m_nWaiterNumber; 95 | } 96 | 97 | if( true == m_bLocked ) 98 | { 99 | SP_ACCESS( m_Semaphore )->Release(); 100 | m_bLocked = false; 101 | } 102 | } 103 | } 104 | 105 | }} // namespace AVT::VmbAPI 106 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Condition.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Condition.h 10 | 11 | Description: Definition of a condition class. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_CONDITION_H 30 | #define AVT_VMBAPI_CONDITION_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class Condition 41 | { 42 | private: 43 | unsigned long m_nReleaseNumber; 44 | unsigned long m_nWaiterNumber; 45 | bool m_bLocked; 46 | SP_DECL( Semaphore ) m_Semaphore; // A binary semaphore (non recursive mutex) 47 | 48 | public: 49 | Condition(); 50 | 51 | void Wait( const BasicLockable &rLockable ); 52 | void Wait( const MutexPtr &rMutex ); 53 | 54 | void Signal( bool bSingle = false ); 55 | }; 56 | 57 | }} // namespace AVT::VmbAPI 58 | 59 | #endif //CONDITION_H -------------------------------------------------------------------------------- /include/VimbaCPP/Source/ConditionHelper.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: ConditionHelper.cpp 10 | 11 | Description: Implementation of helper class for conditions. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | ConditionHelper::ConditionHelper() 37 | : m_nNumListReads( 0 ) 38 | , m_bIsWritingList( false ) 39 | , m_bExclusive( false ) 40 | { 41 | } 42 | 43 | bool ConditionHelper::EnterReadLock( BasicLockable &rLockable ) 44 | { 45 | return EnterReadLock( rLockable.GetMutex() ); 46 | } 47 | bool ConditionHelper::EnterReadLock( MutexPtr pMutex ) 48 | { 49 | MutexGuard guard( pMutex ); 50 | if ( true == m_bExclusive ) 51 | { 52 | guard.Release(); 53 | return false; 54 | } 55 | while ( true == m_bIsWritingList ) 56 | { 57 | m_WriteCondition.Wait( pMutex ); 58 | } 59 | ++m_nNumListReads; 60 | guard.Release(); 61 | 62 | return true; 63 | } 64 | 65 | void ConditionHelper::ExitReadLock( BasicLockable &rLockable ) 66 | { 67 | ExitReadLock( rLockable.GetMutex() ); 68 | } 69 | void ConditionHelper::ExitReadLock( MutexPtr pMutex ) 70 | { 71 | MutexGuard guard( pMutex ); 72 | if ( 0 == --m_nNumListReads ) 73 | { 74 | m_ReadCondition.Signal(); 75 | } 76 | guard.Release(); 77 | } 78 | 79 | bool ConditionHelper::EnterWriteLock( BasicLockable &rLockable, bool bExclusive ) 80 | { 81 | return EnterWriteLock( rLockable.GetMutex(), bExclusive ); 82 | } 83 | bool ConditionHelper::EnterWriteLock( MutexPtr pMutex, bool bExclusive ) 84 | { 85 | MutexGuard guard( pMutex ); 86 | if ( true == m_bExclusive ) 87 | { 88 | guard.Release(); 89 | return false; 90 | } 91 | while ( true == m_bIsWritingList ) 92 | { 93 | m_WriteCondition.Wait( pMutex ); 94 | } 95 | m_bIsWritingList = true; 96 | m_bExclusive = bExclusive; 97 | while ( 0 < m_nNumListReads ) 98 | { 99 | m_ReadCondition.Wait( pMutex ); 100 | } 101 | guard.Release(); 102 | 103 | return true; 104 | } 105 | 106 | void ConditionHelper::ExitWriteLock( BasicLockable &rLockable ) 107 | { 108 | ExitWriteLock( rLockable.GetMutex() ); 109 | } 110 | void ConditionHelper::ExitWriteLock( MutexPtr pMutex ) 111 | { 112 | MutexGuard guard( pMutex ); 113 | m_bIsWritingList = false; 114 | m_bExclusive = false; 115 | m_WriteCondition.Signal(); 116 | guard.Release(); 117 | } 118 | 119 | }} // namespace AV::VimbaAPI 120 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/ConditionHelper.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: ConditionHelper.h 10 | 11 | Description: Definition of helper class for conditions. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_CONDITIONHELPER_H 30 | #define AVT_VMBAPI_CONDITIONHELPER_H 31 | 32 | #include 33 | 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class ConditionHelper 40 | { 41 | public: 42 | ConditionHelper(); 43 | 44 | // Waits until writing access has finished and returns true. 45 | // If exclusive writing access was granted the function exits immediately without locking and returns false 46 | bool EnterReadLock( BasicLockable &rLockable ); 47 | bool EnterReadLock( MutexPtr pMutex ); 48 | void ExitReadLock( BasicLockable &rLockable ); 49 | void ExitReadLock( MutexPtr pMutex ); 50 | 51 | // Waits until writing and reading access have finished and returns true. 52 | // If exclusive writing access was granted the function exits immediately without locking and returns false 53 | bool EnterWriteLock( BasicLockable &rLockable, bool bExclusive = false ); 54 | bool EnterWriteLock( MutexPtr pMutex, bool bExclusive = false ); 55 | void ExitWriteLock( BasicLockable &rLockable ); 56 | void ExitWriteLock( MutexPtr pMutex ); 57 | 58 | private: 59 | Condition m_ReadCondition; 60 | Condition m_WriteCondition; 61 | bool m_bIsWritingList; 62 | bool m_bExclusive; 63 | int m_nNumListReads; 64 | }; 65 | 66 | }} // namespace AVT::VmbAPI 67 | 68 | #endif // CONDITIONHELPER_H -------------------------------------------------------------------------------- /include/VimbaCPP/Source/DefaultCameraFactory.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: DefaultCameraFactory.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::DefaultCameraFactory used to 12 | create new Camera objects if no user defined camera factory 13 | class was provided. 14 | (For internal use only) 15 | 16 | ------------------------------------------------------------------------------- 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 19 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 20 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 26 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | =============================================================================*/ 30 | 31 | #include 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | CameraPtr DefaultCameraFactory::CreateCamera( const char *pCameraID, 37 | const char *pCameraName, 38 | const char *pCameraModel, 39 | const char *pCameraSerialNumber, 40 | const char *pInterfaceID, 41 | VmbInterfaceType eInterfaceType, 42 | const char * /*pInterfaceName*/, 43 | const char * /*pInterfaceSerialNumber*/, 44 | VmbAccessModeType /*interfacePermittedAccess*/ ) 45 | { 46 | return CameraPtr( new Camera( pCameraID, pCameraName, pCameraModel, pCameraSerialNumber, pInterfaceID, eInterfaceType )); 47 | } 48 | 49 | }} // namespace AVT::VmbAPI 50 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/DefaultCameraFactory.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: DefaultCameraFactory.h 10 | 11 | Description: Definition of class AVT::VmbAPI::DefaultCameraFactory used to 12 | create new Camera objects if no user defined camera factory 13 | class was provided. 14 | (For internal use only) 15 | 16 | ------------------------------------------------------------------------------- 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 19 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 20 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 25 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 26 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | =============================================================================*/ 30 | 31 | #ifndef AVT_VMBAPI_DEFAULTCAMERAFACTORY_H 32 | #define AVT_VMBAPI_DEFAULTCAMERAFACTORY_H 33 | 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class DefaultCameraFactory : public virtual ICameraFactory 40 | { 41 | public: 42 | virtual CameraPtr CreateCamera( const char *pCameraID, 43 | const char *pCameraName, 44 | const char *pCameraModel, 45 | const char *pCameraSerialNumber, 46 | const char *pInterfaceID, 47 | VmbInterfaceType interfaceType, 48 | const char *pInterfaceName, 49 | const char *pInterfaceSerialNumber, 50 | VmbAccessModeType interfacePermittedAccess ); 51 | }; 52 | 53 | }} // namespace AVT::VmbAPI 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/EnumFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: EnumFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::EnumFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_ENUMFEATURE_H 30 | #define AVT_VMBAPI_ENUMFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class EnumFeature : public BaseFeature 41 | { 42 | public: 43 | EnumFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ); 44 | 45 | IMEXPORT virtual VmbErrorType SetValue( const char *pValue ); 46 | 47 | IMEXPORT virtual VmbErrorType GetEntry( EnumEntry &entry, const char *pEntryName ) const; 48 | 49 | IMEXPORT virtual VmbErrorType GetValue( VmbInt64_t &value ) const; 50 | IMEXPORT virtual VmbErrorType SetValue( const VmbInt64_t &value ); 51 | 52 | IMEXPORT virtual VmbErrorType IsValueAvailable( const char *pStrValue, bool &available ) const; 53 | IMEXPORT virtual VmbErrorType IsValueAvailable( const VmbInt64_t value, bool &available ) const; 54 | 55 | private: 56 | // Copy of enum elements 57 | StringVector m_EnumStringValues; 58 | Int64Vector m_EnumIntValues; 59 | EnumEntryVector m_EnumEntries; 60 | 61 | // Array functions to pass data across DLL boundaries 62 | IMEXPORT virtual VmbErrorType GetValue( char * const pValue, VmbUint32_t &size ) const; 63 | IMEXPORT virtual VmbErrorType GetValues( const char **pValues, VmbUint32_t &size ); 64 | IMEXPORT virtual VmbErrorType GetValues( VmbInt64_t *pValue, VmbUint32_t &size ); 65 | IMEXPORT virtual VmbErrorType GetEntries( EnumEntry *pEntries, VmbUint32_t &size ); 66 | }; 67 | 68 | }} // namespace AVT::VmbAPI 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FileLogger.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FileLogger.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::FileLogger. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | #ifdef _WIN32 35 | #pragma warning(disable: 4996) 36 | #else //_WIN32 37 | #include 38 | #endif //_WIN32 39 | 40 | namespace AVT { 41 | namespace VmbAPI { 42 | 43 | FileLogger::FileLogger( const char *pFileName, bool bAppend ) 44 | : m_pMutex( MutexPtr( new Mutex() )) 45 | { 46 | std::string strTempPath = GetTempPath(); 47 | std::string strFileName( pFileName ); 48 | 49 | if ( 0 < strTempPath.length() ) 50 | { 51 | strFileName = strTempPath.append( strFileName ); 52 | if( true == bAppend ) 53 | { 54 | m_File.open( strFileName.c_str(), std::fstream::app ); 55 | } 56 | else 57 | { 58 | m_File.open( strFileName.c_str() ); 59 | } 60 | } 61 | else 62 | { 63 | throw; 64 | } 65 | } 66 | 67 | FileLogger::FileLogger( const FileLogger& ) 68 | { 69 | // No copy ctor 70 | } 71 | 72 | FileLogger& FileLogger::operator=( const FileLogger& ) 73 | { 74 | // No assignment operator 75 | return *this; 76 | } 77 | 78 | FileLogger::~FileLogger() 79 | { 80 | if( true == m_File.is_open() ) 81 | { 82 | m_File.close(); 83 | } 84 | } 85 | 86 | void FileLogger::Log( const std::string &rStrMessage ) 87 | { 88 | MutexGuard guard( m_pMutex ); 89 | 90 | if( true == m_File.is_open() ) 91 | { 92 | #ifdef _WIN32 93 | time_t nTime = time( &nTime ); 94 | tm timeInfo; 95 | localtime_s( &timeInfo, &nTime ); 96 | char strTime[100]; 97 | asctime_s( strTime, 100, &timeInfo ); 98 | #else 99 | time_t nTime = time( NULL ); 100 | std::string strTime = asctime( localtime( &nTime ) ); 101 | #endif 102 | 103 | m_File << strTime << ": " << rStrMessage << std::endl; 104 | m_File.flush(); 105 | } 106 | } 107 | 108 | std::string FileLogger::GetTempPath() 109 | { 110 | #ifndef _WIN32 111 | std::string tmpDir; 112 | 113 | if(tmpDir.size() == 0) 114 | { 115 | char *pPath = std::getenv("TMPDIR"); 116 | if(NULL != pPath) 117 | { 118 | struct stat lStats; 119 | if(stat(pPath, &lStats) == 0) 120 | { 121 | tmpDir = pPath; 122 | } 123 | } 124 | } 125 | if(tmpDir.size() == 0) 126 | { 127 | char *pPath = std::getenv("TEMP"); 128 | if(NULL != pPath) 129 | { 130 | struct stat lStats; 131 | if(stat(pPath, &lStats) == 0) 132 | { 133 | tmpDir = pPath; 134 | } 135 | } 136 | } 137 | if(tmpDir.size() == 0) 138 | { 139 | char *pPath = std::getenv("TMP"); 140 | if(NULL != pPath) 141 | { 142 | struct stat lStats; 143 | if(stat(pPath, &lStats) == 0) 144 | { 145 | tmpDir = pPath; 146 | } 147 | } 148 | } 149 | if(tmpDir.size() == 0) 150 | { 151 | std::string path = "/tmp"; 152 | struct stat lStats; 153 | if(stat(path.c_str(), &lStats) == 0) 154 | { 155 | tmpDir = path; 156 | } 157 | } 158 | if(tmpDir.size() == 0) 159 | { 160 | std::string path = "/var/tmp"; 161 | struct stat lStats; 162 | if(stat(path.c_str(), &lStats) == 0) 163 | { 164 | tmpDir = path; 165 | } 166 | } 167 | if(tmpDir.size() == 0) 168 | { 169 | std::string path = "/usr/tmp"; 170 | struct stat lStats; 171 | if(stat(path.c_str(), &lStats) == 0) 172 | { 173 | tmpDir = path; 174 | } 175 | } 176 | if(tmpDir.size() == 0) 177 | { 178 | return ""; 179 | } 180 | // everyone expects delimiter on the outside 181 | if( (*tmpDir.rbegin()) != '/' ) 182 | { 183 | tmpDir +='/'; 184 | } 185 | return tmpDir; 186 | #else 187 | DWORD length = ::GetTempPathA( 0, NULL ); 188 | if( length == 0 ) 189 | { 190 | return ""; 191 | } 192 | 193 | std::vector tempPath( length ); 194 | 195 | length = ::GetTempPath( static_cast( tempPath.size() ), &tempPath[0] ); 196 | if( length == 0 || length > tempPath.size() ) 197 | { 198 | return ""; 199 | } 200 | 201 | return std::string( tempPath.begin(), tempPath.begin() + static_cast(length) ); 202 | #endif 203 | } 204 | 205 | }} //namespace AV::VmbAPI 206 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FloatFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FloatFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::FloatFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | FloatFeature::FloatFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ) 35 | : BaseFeature( featureInfo, pFeatureContainer ) 36 | { 37 | } 38 | 39 | VmbErrorType FloatFeature::GetValue( double &rfValue ) const 40 | { 41 | if ( NULL == m_pFeatureContainer ) 42 | { 43 | return VmbErrorDeviceNotOpen; 44 | } 45 | 46 | return (VmbErrorType)VmbFeatureFloatGet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rfValue ); 47 | } 48 | 49 | VmbErrorType FloatFeature::SetValue( const double &rfValue ) 50 | { 51 | if ( NULL == m_pFeatureContainer ) 52 | { 53 | return VmbErrorDeviceNotOpen; 54 | } 55 | 56 | return (VmbErrorType)VmbFeatureFloatSet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), rfValue ); 57 | } 58 | 59 | VmbErrorType FloatFeature::GetRange( double &rfMinimum, double &rfMaximum ) const 60 | { 61 | if ( NULL == m_pFeatureContainer ) 62 | { 63 | return VmbErrorDeviceNotOpen; 64 | } 65 | 66 | return (VmbErrorType)VmbFeatureFloatRangeQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rfMinimum, &rfMaximum ); 67 | } 68 | 69 | VmbErrorType FloatFeature::HasIncrement( VmbBool_t &incrementSupported ) const 70 | { 71 | if ( NULL == m_pFeatureContainer ) 72 | { 73 | return VmbErrorDeviceNotOpen; 74 | } 75 | VmbBool_t hasIncrement; 76 | VmbError_t Result =VmbFeatureFloatIncrementQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(),&hasIncrement, NULL ); 77 | if( VmbErrorSuccess == Result) 78 | { 79 | incrementSupported = hasIncrement; 80 | return VmbErrorSuccess; 81 | } 82 | return static_cast( Result); 83 | } 84 | 85 | VmbErrorType FloatFeature::GetIncrement( double &rnIncrement ) const 86 | { 87 | if ( NULL == m_pFeatureContainer ) 88 | { 89 | return VmbErrorDeviceNotOpen; 90 | } 91 | VmbBool_t hasIncrement; 92 | VmbError_t Result =VmbFeatureFloatIncrementQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(),&hasIncrement, &rnIncrement ); 93 | if( VmbErrorSuccess == Result && !hasIncrement) 94 | { 95 | return VmbErrorNotImplemented; 96 | } 97 | return static_cast( Result); 98 | } 99 | 100 | }} // namespace AVT::VmbAPI 101 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FloatFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FloatFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::FloatFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_FLOATFEATURE_H 30 | #define AVT_VMBAPI_FLOATFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class FloatFeature : public BaseFeature 41 | { 42 | public: 43 | FloatFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ); 44 | 45 | IMEXPORT virtual VmbErrorType GetValue( double &value ) const; 46 | 47 | IMEXPORT virtual VmbErrorType SetValue( const double &rfValue ); 48 | 49 | IMEXPORT virtual VmbErrorType GetRange( double &minimum, double &maximum ) const; 50 | 51 | IMEXPORT virtual VmbErrorType HasIncrement( VmbBool_t &incrementSupported) const; 52 | 53 | IMEXPORT virtual VmbErrorType GetIncrement( double &increment ) const; 54 | }; 55 | 56 | }} // namespace AVT::VmbAPI 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FrameHandler.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FrameHandler.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::FrameHandler. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace AVT { 33 | namespace VmbAPI { 34 | 35 | FrameHandler::FrameHandler( FramePtr pFrame, IFrameObserverPtr pFrameObserver ) 36 | : m_pFrame( pFrame ) 37 | , m_pObserver( pFrameObserver ) 38 | , m_pMutex( new Mutex() ) 39 | { 40 | } 41 | 42 | FramePtr FrameHandler::GetFrame() const 43 | { 44 | return m_pFrame; 45 | } 46 | 47 | bool FrameHandler::EnterWriteLock( bool bExclusive ) 48 | { 49 | return m_conditionHelper.EnterWriteLock( m_pMutex, bExclusive ); 50 | } 51 | 52 | void FrameHandler::ExitWriteLock() 53 | { 54 | m_conditionHelper.ExitWriteLock( m_pMutex ); 55 | } 56 | 57 | bool FrameHandler::EnterReadLock() 58 | { 59 | return m_conditionHelper.EnterReadLock( m_pMutex ); 60 | } 61 | 62 | void FrameHandler::ExitReadLock() 63 | { 64 | m_conditionHelper.ExitReadLock( m_pMutex ); 65 | } 66 | 67 | void VMB_CALL FrameHandler::FrameDoneCallback( const VmbHandle_t /*handle*/, VmbFrame_t *pVmbFrame ) 68 | { 69 | if ( NULL != pVmbFrame ) 70 | { 71 | FrameHandler* pFrameHandler = reinterpret_cast( pVmbFrame->context[FRAME_HDL] ); 72 | if ( NULL != pFrameHandler) 73 | { 74 | // Begin read lock frame handler 75 | 76 | if ( true == pFrameHandler->EnterReadLock() ) 77 | { 78 | { 79 | IFrameObserverPtr pObs; 80 | if ( true == SP_ACCESS( pFrameHandler->m_pFrame )->GetObserver( pObs )) 81 | { 82 | SP_ACCESS( pObs )->FrameReceived( pFrameHandler->m_pFrame ); 83 | } 84 | }// scope to destroy observer pointer before releasing the lock 85 | // End read lock frame handler 86 | pFrameHandler->ExitReadLock(); 87 | } 88 | else 89 | { 90 | LOG_FREE_TEXT( "Could not lock frame handler. Skipping frame." ) 91 | } 92 | } 93 | else // No FrameHandler 94 | { 95 | LOG_FREE_TEXT( "No frame handler passed. Frame has been removed from the frame queue." ) 96 | } 97 | } 98 | else // pVmbFrame == NULL (Just for safety) 99 | { 100 | LOG_FREE_TEXT( "Received callback for already freed frame." ) 101 | } 102 | } 103 | 104 | }} 105 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FrameHandler.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FrameHandler.h 10 | 11 | Description: Definition of class AVT::VmbAPI::FrameHandler. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 17 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 19 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 23 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | =============================================================================*/ 27 | 28 | #ifndef AVT_VMBAPI_FRAMEHANDLER_H 29 | #define AVT_VMBAPI_FRAMEHANDLER_H 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | namespace AVT { 41 | namespace VmbAPI { 42 | 43 | enum { FRAME_HDL=0, }; 44 | 45 | class FrameHandler 46 | { 47 | public: 48 | static void VMB_CALL FrameDoneCallback( const VmbHandle_t handle, VmbFrame_t *pFrame ); 49 | 50 | FrameHandler( FramePtr pFrame, IFrameObserverPtr pFrameObserver ); 51 | 52 | FramePtr GetFrame() const; 53 | 54 | bool EnterWriteLock( bool bExclusive = false ); 55 | void ExitWriteLock(); 56 | bool EnterReadLock(); 57 | void ExitReadLock(); 58 | 59 | private: 60 | IFrameObserverPtr m_pObserver; 61 | FramePtr m_pFrame; 62 | ConditionHelper m_conditionHelper; 63 | MutexPtr m_pMutex; 64 | }; 65 | 66 | typedef std::vector FrameHandlerPtrVector; 67 | 68 | }} // namespace AVT::VmbAPI 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/FrameImpl.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: FrameImpl.h 10 | 11 | Description: Definition of pointer to implementation structure used by 12 | AVT::VmbAPI::Frame. 13 | (For internal use only) 14 | 15 | ------------------------------------------------------------------------------- 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 18 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 19 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | =============================================================================*/ 29 | 30 | #ifndef AVT_VMBAPI_FRAMEIMPL_H 31 | #define AVT_VMBAPI_FRAMEIMPL_H 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | struct Frame::Impl 37 | { 38 | VmbUchar_t *m_pBuffer; 39 | bool m_bIsUserBuffer; 40 | 41 | VmbFrame_t m_frame; 42 | 43 | IFrameObserverPtr m_pObserver; 44 | MutexPtr m_pObserverMutex; 45 | ConditionHelper m_observerConditionHelper; 46 | 47 | bool m_bAlreadyAnnounced; 48 | bool m_bAlreadyQueued; 49 | 50 | void Init(); 51 | }; 52 | 53 | }} 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Helper.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Helper.h 10 | 11 | Description: Definition of helper classes (types) 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_HELPER_H 30 | #define AVT_VMBAPI_HELPER_H 31 | 32 | #include 33 | 34 | namespace AVT { 35 | namespace VmbAPI { 36 | 37 | template 38 | class LockableVector : public virtual BasicLockable 39 | { 40 | public: 41 | std::vector Vector; 42 | }; 43 | 44 | template 45 | class LockableMap : public virtual BasicLockable 46 | { 47 | public: 48 | std::map Map; 49 | }; 50 | 51 | char const * const AVT_IP_OR_MAC_ADDRESS = "IP_OR_MAC@"; 52 | 53 | }} // AVT::VmbAPI 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/IntFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: IntFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::IntFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | IntFeature::IntFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ) 35 | : BaseFeature( featureInfo, pFeatureContainer ) 36 | { 37 | } 38 | 39 | VmbErrorType IntFeature::GetValue( VmbInt64_t &rnValue ) const 40 | { 41 | if ( NULL == m_pFeatureContainer ) 42 | { 43 | return VmbErrorDeviceNotOpen; 44 | } 45 | 46 | return (VmbErrorType)VmbFeatureIntGet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rnValue ); 47 | } 48 | 49 | VmbErrorType IntFeature::SetValue( const VmbInt64_t &rnValue ) 50 | { 51 | if ( NULL == m_pFeatureContainer ) 52 | { 53 | return VmbErrorDeviceNotOpen; 54 | } 55 | 56 | return (VmbErrorType)VmbFeatureIntSet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), rnValue ); 57 | } 58 | 59 | VmbErrorType IntFeature::GetRange( VmbInt64_t &rnMinimum, VmbInt64_t &rnMaximum ) const 60 | { 61 | if ( NULL == m_pFeatureContainer ) 62 | { 63 | return VmbErrorDeviceNotOpen; 64 | } 65 | 66 | return (VmbErrorType)VmbFeatureIntRangeQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rnMinimum, &rnMaximum ); 67 | } 68 | 69 | VmbErrorType IntFeature::HasIncrement( VmbBool_t & incrementSupported) const 70 | { 71 | incrementSupported = VmbBoolTrue; 72 | return VmbErrorSuccess; 73 | } 74 | VmbErrorType IntFeature::GetIncrement( VmbInt64_t &rnIncrement ) const 75 | { 76 | if ( NULL == m_pFeatureContainer ) 77 | { 78 | return VmbErrorDeviceNotOpen; 79 | } 80 | 81 | return (VmbErrorType)VmbFeatureIntIncrementQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rnIncrement ); 82 | } 83 | 84 | 85 | }} // namespace AVT::VmbAPI 86 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/IntFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: IntFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::IntFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_INTFEATURE_H 30 | #define AVT_VMBAPI_INTFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class IntFeature : public BaseFeature 41 | { 42 | public: 43 | IntFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ); 44 | 45 | IMEXPORT virtual VmbErrorType GetValue( VmbInt64_t &value ) const; 46 | 47 | IMEXPORT virtual VmbErrorType SetValue( const VmbInt64_t &value ); 48 | 49 | IMEXPORT virtual VmbErrorType GetRange( VmbInt64_t &minimum, VmbInt64_t &maximum ) const; 50 | 51 | IMEXPORT virtual VmbErrorType HasIncrement( VmbBool_t &incrementSupported) const; 52 | 53 | IMEXPORT virtual VmbErrorType GetIncrement( VmbInt64_t &increment ) const; 54 | }; 55 | 56 | }} // namespace AVT::VmbAPI 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Mutex.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Mutex.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::Mutex. 12 | (This include file is for internal use only.) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace AVT { 35 | namespace VmbAPI { 36 | 37 | Mutex::Mutex( bool bInitLock ) 38 | #ifdef WIN32 39 | : m_hMutex( NULL ) 40 | #endif 41 | { 42 | #ifdef WIN32 43 | m_hMutex = CreateMutex( NULL, FALSE, NULL ); 44 | if( NULL == m_hMutex ) 45 | { 46 | LOG_FREE_TEXT( "Could not create mutex." ); 47 | throw std::bad_alloc(); 48 | } 49 | #else 50 | pthread_mutex_init(&m_Mutex, NULL); 51 | #endif 52 | 53 | if( true == bInitLock ) 54 | { 55 | Lock(); 56 | } 57 | } 58 | 59 | Mutex::~Mutex() 60 | { 61 | #ifdef WIN32 62 | CloseHandle( m_hMutex ); 63 | #else 64 | pthread_mutex_destroy(&m_Mutex); 65 | #endif 66 | } 67 | 68 | Mutex::Mutex( const Mutex& ) 69 | { 70 | // No copy ctor 71 | } 72 | 73 | Mutex& Mutex::operator=( const Mutex& ) 74 | { 75 | // No assignment operator 76 | return *this; 77 | } 78 | 79 | void Mutex::Lock() 80 | { 81 | #ifdef WIN32 82 | WaitForSingleObject( m_hMutex, INFINITE ); 83 | #else 84 | pthread_mutex_lock( &m_Mutex ); 85 | #endif 86 | } 87 | 88 | void Mutex::Unlock() 89 | { 90 | #ifdef WIN32 91 | ReleaseMutex( m_hMutex ); 92 | #else 93 | pthread_mutex_unlock( &m_Mutex ); 94 | #endif 95 | } 96 | 97 | }} //namespace AVT::VmbAPI 98 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/MutexGuard.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: MutexGuard.cpp 10 | 11 | Description: Implementation of a mutex helper class for locking and unlocking. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | MutexGuard::MutexGuard() 37 | { 38 | } 39 | 40 | MutexGuard::MutexGuard( MutexPtr pMutex ) 41 | { 42 | if ( SP_ISNULL( pMutex )) 43 | { 44 | LOG_FREE_TEXT( "No mutex passed." ); 45 | } 46 | else 47 | { 48 | Protect( pMutex ); 49 | } 50 | } 51 | 52 | MutexGuard::MutexGuard( BasicLockablePtr pLockable ) 53 | { 54 | if ( SP_ISNULL( pLockable )) 55 | { 56 | LOG_FREE_TEXT( "No mutex passed." ); 57 | } 58 | else 59 | { 60 | Protect( pLockable ); 61 | } 62 | } 63 | 64 | MutexGuard::MutexGuard( const BasicLockable &rLockable ) 65 | { 66 | Protect( rLockable ); 67 | } 68 | 69 | MutexGuard::~MutexGuard() 70 | { 71 | Release(); 72 | } 73 | 74 | void MutexGuard::Protect( MutexPtr pMutex ) 75 | { 76 | if( SP_ISNULL( pMutex )) 77 | { 78 | LOG_FREE_TEXT( "No mutex passed." ); 79 | } 80 | 81 | else if( SP_ISEQUAL( pMutex, m_pMutex )) 82 | { 83 | return; 84 | } 85 | 86 | Release(); 87 | 88 | SP_ACCESS( pMutex )->Lock(); 89 | m_pMutex = pMutex; 90 | } 91 | 92 | void MutexGuard::Protect( BasicLockablePtr pLockable ) 93 | { 94 | if( SP_ISNULL( SP_ACCESS( pLockable )->GetMutex() )) 95 | { 96 | LOG_FREE_TEXT( "No mutex passed." ); 97 | } 98 | else 99 | { 100 | Protect( SP_ACCESS( pLockable )->GetMutex() ); 101 | } 102 | } 103 | 104 | void MutexGuard::Protect( const BasicLockable &rLockable ) 105 | { 106 | Protect( rLockable.GetMutex() ); 107 | } 108 | 109 | bool MutexGuard::Release() 110 | { 111 | if( SP_ISNULL( m_pMutex )) 112 | { 113 | return false; 114 | } 115 | 116 | SP_ACCESS( m_pMutex )->Unlock(); 117 | SP_RESET( m_pMutex ); 118 | 119 | return true; 120 | } 121 | 122 | }} //namespace AVT::VmbAPI 123 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/MutexGuard.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: MutexGuard.h 10 | 11 | Description: Definition of a mutex helper class for locking and unlocking. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_MUTEXGUARD 30 | #define AVT_VMBAPI_MUTEXGUARD 31 | 32 | #include 33 | #include 34 | 35 | namespace AVT 36 | { 37 | namespace VmbAPI 38 | { 39 | 40 | class MutexGuard 41 | { 42 | public: 43 | MutexGuard(); 44 | MutexGuard( MutexPtr pMutex ); 45 | MutexGuard( BasicLockablePtr pLockable ); 46 | MutexGuard( const BasicLockable &rLockable ); 47 | ~MutexGuard(); 48 | 49 | void Protect( MutexPtr pMutex ); 50 | void Protect( BasicLockablePtr pLockable ); 51 | void Protect( const BasicLockable &rLockable ); 52 | 53 | bool Release(); 54 | 55 | protected: 56 | MutexPtr m_pMutex; 57 | }; 58 | 59 | } //namespace VmbAPI 60 | } //namespace AVT 61 | 62 | #endif //AVT_VMBAPI_MUTEXGUARD 63 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/RawFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: RawFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::RawFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | RawFeature::RawFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer *pFeatureContainer ) 35 | : BaseFeature( featureInfo, pFeatureContainer ) 36 | { 37 | } 38 | 39 | VmbErrorType RawFeature::GetValue( VmbUchar_t *pValue, VmbUint32_t &rnSize, VmbUint32_t &rnSizeFilled ) const 40 | { 41 | VmbError_t res; 42 | VmbUint32_t nSize; 43 | 44 | if ( NULL == m_pFeatureContainer ) 45 | { 46 | return VmbErrorDeviceNotOpen; 47 | } 48 | 49 | res = VmbFeatureRawLengthQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &nSize ); 50 | 51 | if ( NULL != pValue ) 52 | { 53 | if ( rnSize < nSize ) 54 | { 55 | return VmbErrorMoreData; 56 | } 57 | 58 | if ( VmbErrorSuccess == res ) 59 | { 60 | res = VmbFeatureRawGet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), (char*)pValue, rnSize, &rnSizeFilled ); 61 | } 62 | } 63 | else 64 | { 65 | rnSize = nSize; 66 | } 67 | 68 | return (VmbErrorType)res; 69 | } 70 | 71 | VmbErrorType RawFeature::SetValue( const VmbUchar_t *pValue, VmbUint32_t nSize ) 72 | { 73 | if ( NULL == m_pFeatureContainer ) 74 | { 75 | return VmbErrorDeviceNotOpen; 76 | } 77 | 78 | if ( NULL == pValue ) 79 | { 80 | return VmbErrorBadParameter; 81 | } 82 | 83 | return (VmbErrorType)VmbFeatureRawSet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), (const char*)pValue, nSize ); 84 | } 85 | 86 | }} // namespace AVT::VmbAPI 87 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/RawFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: RawFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::RawFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_RAWFEATURE_H 30 | #define AVT_VMBAPI_RAWFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class RawFeature : public BaseFeature 41 | { 42 | public: 43 | RawFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer *pFeatureContainer ); 44 | 45 | private: 46 | // Array functions to pass data across DLL boundaries 47 | IMEXPORT virtual VmbErrorType GetValue( VmbUchar_t *pValue, VmbUint32_t &size, VmbUint32_t &sizeFilled ) const; 48 | IMEXPORT virtual VmbErrorType SetValue( const VmbUchar_t *pValue, VmbUint32_t size ); 49 | }; 50 | 51 | }} // namespace AVT::VmbAPI 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Semaphore.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Semaphore.cpp 10 | 11 | Description: Implementation of an semaphore class. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace AVT { 35 | namespace VmbAPI { 36 | 37 | Semaphore::Semaphore( int nInit, int nMax ) 38 | #ifdef WIN32 39 | : m_hSemaphore( NULL ) 40 | #endif 41 | { 42 | #ifdef WIN32 43 | m_hSemaphore = CreateSemaphore( NULL, nInit, nMax, NULL ); 44 | if( NULL == m_hSemaphore ) 45 | { 46 | LOG_FREE_TEXT( "Could not create semaphore." ); 47 | throw std::bad_alloc(); 48 | } 49 | #else 50 | sem_init( &m_Semaphore, false, (unsigned int)nInit ); 51 | #endif 52 | } 53 | 54 | Semaphore::Semaphore( const Semaphore& ) 55 | { 56 | // No compiler generated copy ctor 57 | } 58 | 59 | Semaphore& Semaphore::operator=( const Semaphore& ) 60 | { 61 | // No assignment operator 62 | return *this; 63 | } 64 | 65 | Semaphore::~Semaphore() 66 | { 67 | #ifdef WIN32 68 | CloseHandle( m_hSemaphore ); 69 | #else 70 | sem_destroy( &m_Semaphore ); 71 | #endif 72 | } 73 | 74 | void Semaphore::Acquire() 75 | { 76 | #ifdef WIN32 77 | WaitForSingleObject( m_hSemaphore, INFINITE ); 78 | #else 79 | sem_wait( &m_Semaphore ); 80 | #endif 81 | } 82 | 83 | void Semaphore::Release() 84 | { 85 | #ifdef WIN32 86 | ReleaseSemaphore( m_hSemaphore, 1, NULL ); 87 | #else 88 | sem_post( &m_Semaphore ); 89 | #endif 90 | } 91 | 92 | } //namespace VmbAPI 93 | } //namespace AVT -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Semaphore.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: Semaphore.h 10 | 11 | Description: Definition of an semaphore class. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_SEMAPHORE 30 | #define AVT_VMBAPI_SEMAPHORE 31 | 32 | #include 33 | 34 | #ifdef WIN32 35 | #include 36 | #else 37 | #include 38 | #endif 39 | 40 | namespace AVT { 41 | namespace VmbAPI { 42 | 43 | class Semaphore 44 | { 45 | public: 46 | Semaphore( int nInit = 0, int nMax = 1 ); 47 | ~Semaphore(); 48 | 49 | void Acquire(); 50 | void Release(); 51 | 52 | private: 53 | // No copy ctor 54 | Semaphore( const Semaphore &rSemaphore ); 55 | // No assignment 56 | Semaphore& operator=( const Semaphore& ); 57 | 58 | #ifdef WIN32 59 | HANDLE m_hSemaphore; 60 | #else 61 | sem_t m_Semaphore; 62 | #endif 63 | }; 64 | 65 | }} //namespace AVT::VmbAPI 66 | 67 | #endif //AVT_VMBAPI_MUTEX 68 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/StringFeature.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: StringFeature.cpp 10 | 11 | Description: Implementation of class AVT::VmbAPI::StringFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #include 30 | 31 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | StringFeature::StringFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ) 35 | : BaseFeature( featureInfo, pFeatureContainer ) 36 | { 37 | } 38 | 39 | VmbErrorType StringFeature::GetValue( char * const pStrValue, VmbUint32_t &rnLength ) const 40 | { 41 | if ( NULL == m_pFeatureContainer ) 42 | { 43 | return VmbErrorDeviceNotOpen; 44 | } 45 | 46 | if ( NULL == pStrValue ) 47 | { 48 | return (VmbErrorType)VmbFeatureStringMaxlengthQuery( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), &rnLength ); 49 | } 50 | else 51 | { 52 | return (VmbErrorType)VmbFeatureStringGet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), pStrValue, rnLength, &rnLength ); 53 | } 54 | } 55 | 56 | VmbErrorType StringFeature::SetValue( const char *pStrValue ) 57 | { 58 | if ( NULL == m_pFeatureContainer ) 59 | { 60 | return VmbErrorDeviceNotOpen; 61 | } 62 | 63 | return (VmbErrorType)VmbFeatureStringSet( m_pFeatureContainer->GetHandle(), m_featureInfo.name.c_str(), pStrValue ); 64 | } 65 | 66 | 67 | }} // namespace AVT::VmbAPI 68 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/StringFeature.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 3 | 4 | Redistribution of this file, in original or modified form, without 5 | prior written consent of Allied Vision Technologies is prohibited. 6 | 7 | ------------------------------------------------------------------------------- 8 | 9 | File: StringFeature.h 10 | 11 | Description: Definition of class AVT::VmbAPI::StringFeature. 12 | (For internal use only) 13 | 14 | ------------------------------------------------------------------------------- 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 18 | NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | =============================================================================*/ 28 | 29 | #ifndef AVT_VMBAPI_STRINGFEATURE_H 30 | #define AVT_VMBAPI_STRINGFEATURE_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | class StringFeature : public BaseFeature 41 | { 42 | public: 43 | StringFeature( const VmbFeatureInfo_t *featureInfo, FeatureContainer* const pFeatureContainer ); 44 | 45 | IMEXPORT virtual VmbErrorType SetValue( const char *pValue ); 46 | 47 | private: 48 | // Array functions to pass data across DLL boundaries 49 | IMEXPORT virtual VmbErrorType GetValue( char * const pValue, VmbUint32_t &length ) const; 50 | }; 51 | 52 | }} // namespace AVT::VmbAPI 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/VimbaCPP/Source/Version.h: -------------------------------------------------------------------------------- 1 | #ifndef AVT_VMBAPI_VERSION_H 2 | #define AVT_VMBAPI_VERSION_H 3 | 4 | #define VIMBACPP_VERSION_MAJOR 1 5 | #define VIMBACPP_VERSION_MINOR 5 6 | #define VIMBACPP_VERSION_PATCH 0 7 | 8 | #endif //AVT_VMBAPI_VERSION_H 9 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/frame_observer.h: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearican Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearican Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearican Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #ifndef FRAME_OBSERVER_H 34 | #define FRAME_OBSERVER_H 35 | 36 | #include 37 | 38 | #include 39 | 40 | using namespace AVT::VmbAPI; 41 | 42 | class FrameObserver : virtual public IFrameObserver 43 | { 44 | public: 45 | 46 | typedef boost::function Callback; 47 | 48 | // We pass the camera that will deliver the frames to the constructor 49 | FrameObserver( CameraPtr cam_ptr, Callback callback); 50 | 51 | // Destructor 52 | ~FrameObserver(){}; 53 | 54 | // This is our callback routine that will be executed on every received frame 55 | virtual void FrameReceived( const FramePtr vimba_frame_ptr ); 56 | 57 | private: 58 | // Frame observer stores all FramePtr 59 | CameraPtr cam_ptr_; 60 | Callback callback_; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/mono_camera.h: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearic Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearic Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearic Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #ifndef MONO_CAMERA_H 34 | #define MONO_CAMERA_H 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include 48 | 49 | namespace avt_vimba_camera { 50 | class MonoCamera { 51 | public: 52 | MonoCamera(ros::NodeHandle& nh, ros::NodeHandle& nhp); 53 | ~MonoCamera(void); 54 | 55 | private: 56 | AvtVimbaApi api_; 57 | AvtVimbaCamera cam_; 58 | 59 | // diagnostic_updater::Updater updater_; 60 | // diagnostic_updater::TopicDiagnostic* pub_freq_; 61 | 62 | ros::NodeHandle nh_; 63 | ros::NodeHandle nhp_; 64 | 65 | std::string ip_; 66 | std::string guid_; 67 | std::string camera_info_url_; 68 | bool show_debug_prints_; 69 | 70 | image_transport::ImageTransport it_; 71 | // ROS Camera publisher 72 | image_transport::CameraPublisher pub_; 73 | 74 | 75 | 76 | // sensor_msgs::CameraInfo left_info_; 77 | boost::shared_ptr info_man_; 78 | 79 | // Dynamic reconfigure 80 | typedef avt_vimba_camera::AvtVimbaCameraConfig Config; 81 | typedef dynamic_reconfigure::Server ReconfigureServer; 82 | ReconfigureServer reconfigure_server_; 83 | 84 | // Camera configuration 85 | Config camera_config_; 86 | 87 | void frameCallback(const FramePtr& vimba_frame_ptr); 88 | void configure(Config& newconfig, uint32_t level); 89 | void updateCameraInfo(const Config& config); 90 | }; 91 | } 92 | #endif 93 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/mono_camera_nodelet.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "avt_vimba_camera/mono_camera.h" 3 | 4 | namespace avt_vimba_camera 5 | { 6 | 7 | class MonoCameraNodelet : public nodelet::Nodelet 8 | { 9 | public: 10 | virtual void onInit(); 11 | virtual ~MonoCameraNodelet(); 12 | private: 13 | MonoCamera* camera_; 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/stereo_camera.h: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearic Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearic Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearic Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #ifndef STEREO_CAMERA_H 34 | #define STEREO_CAMERA_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | using namespace boost; 61 | 62 | namespace avt_vimba_camera { 63 | class StereoCamera { 64 | public: 65 | StereoCamera(ros::NodeHandle nh, ros::NodeHandle nhp); 66 | ~StereoCamera(void); 67 | void run(); 68 | 69 | private: 70 | AvtVimbaApi api_; 71 | AvtVimbaCamera left_cam_; 72 | AvtVimbaCamera right_cam_; 73 | 74 | diagnostic_updater::Updater updater_; 75 | diagnostic_updater::TopicDiagnostic* pub_freq_; 76 | diagnostic_updater::FunctionDiagnosticTask* sync_check_; 77 | bool show_debug_prints_; 78 | 79 | // Parameters 80 | std::string left_ip_; 81 | std::string right_ip_; 82 | std::string left_guid_; 83 | std::string right_guid_; 84 | std::string left_camera_info_url_; 85 | std::string right_camera_info_url_; 86 | 87 | // Node handles 88 | ros::NodeHandle nh_; 89 | ros::NodeHandle nhp_; 90 | ros::NodeHandle left_nhp_; 91 | ros::NodeHandle right_nhp_; 92 | 93 | // Image transport 94 | image_transport::ImageTransport it_; 95 | 96 | // ROS Camera publisher 97 | image_transport::CameraPublisher left_pub_; 98 | image_transport::CameraPublisher right_pub_; 99 | 100 | // Publish camera temperatures 101 | ros::Publisher pub_left_temp_; 102 | ros::Publisher pub_right_temp_; 103 | 104 | boost::shared_ptr left_info_man_; 105 | boost::shared_ptr right_info_man_; 106 | 107 | // Dynamic reconfigure 108 | typedef avt_vimba_camera::AvtVimbaCameraConfig Config; 109 | typedef avt_vimba_camera::AvtVimbaCameraStereoConfig StereoConfig; 110 | typedef dynamic_reconfigure::Server ReconfigureServer; 111 | ReconfigureServer reconfigure_server_; 112 | 113 | // Camera configuration 114 | StereoConfig camera_config_; 115 | 116 | // Sync 117 | std::vector r_imgs_buffer_; 118 | std::vector l_imgs_buffer_; 119 | int imgs_buffer_size_; 120 | mutex l_sync_mutex_; 121 | mutex r_sync_mutex_; 122 | double max_sec_diff_; 123 | 124 | void leftFrameCallback(const FramePtr& vimba_frame_ptr); 125 | void rightFrameCallback(const FramePtr& vimba_frame_ptr); 126 | void syncCallback(); 127 | void configure(StereoConfig& newconfig, uint32_t level); 128 | void updateCameraInfo(const StereoConfig& config); 129 | void copyConfig(StereoConfig& sc, Config& lc, Config& rc); 130 | void checkCallback(); 131 | }; 132 | } 133 | #endif 134 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/stereo_camera_nodelet.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "avt_vimba_camera/stereo_camera.h" 3 | 4 | namespace avt_vimba_camera 5 | { 6 | 7 | class StereoCameraNodelet : public nodelet::Nodelet 8 | { 9 | public: 10 | virtual void onInit(); 11 | virtual ~StereoCameraNodelet(); 12 | private: 13 | StereoCamera* camera_; 14 | }; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/sync.h: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearic Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearic Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearic Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #ifndef SYNC_H 34 | #define SYNC_H 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | using namespace std; 46 | 47 | namespace avt_vimba_camera { 48 | class Sync { 49 | 50 | public: 51 | Sync(ros::NodeHandle nh, ros::NodeHandle nhp); 52 | void run(); 53 | 54 | protected: 55 | 56 | void msgsCallback(const sensor_msgs::ImageConstPtr& l_img_msg, 57 | const sensor_msgs::ImageConstPtr& r_img_msg, 58 | const sensor_msgs::CameraInfoConstPtr& l_info_msg, 59 | const sensor_msgs::CameraInfoConstPtr& r_info_msg); 60 | 61 | void syncCallback(const ros::TimerEvent&); 62 | 63 | private: 64 | 65 | // Node handles 66 | ros::NodeHandle nh_; 67 | ros::NodeHandle nhp_; 68 | 69 | bool init_; //!> True when node is initialized. 70 | double last_ros_sync_; //!> Last ros time sync 71 | double timer_period_; //!> Timer period 72 | double max_unsync_time_; //!> Maximum time without sync 73 | ros::Timer sync_timer_; //!> Timer to check the image sync 74 | string camera_; //!> Camera name 75 | 76 | // Topic sync 77 | typedef message_filters::sync_policies::ApproximateTime SyncPolicy; 81 | typedef message_filters::Synchronizer SyncType; 82 | 83 | // Image transport 84 | image_transport::ImageTransport it_; 85 | 86 | ros::Publisher pub_info_; //!> Publish reset info 87 | }; 88 | } 89 | #endif 90 | -------------------------------------------------------------------------------- /launch/calibration.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /launch/mono_camera.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 24 | 25 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /launch/mono_camera_nodelet.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /launch/record.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /launch/stereo_camera_nodelet.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /launch/stereo_camera_one_node.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /launch/stereo_camera_two_nodes.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /lib/32bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/32bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/32bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/32bit/libVimbaCPP.so -------------------------------------------------------------------------------- /lib/64bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/64bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/64bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/64bit/libVimbaCPP.so -------------------------------------------------------------------------------- /lib/arm_32bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/arm_32bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/arm_32bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/arm_32bit/libVimbaCPP.so -------------------------------------------------------------------------------- /lib/arm_64bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/arm_64bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/arm_64bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srv/avt_vimba_camera/47e83f9cb9c7d88516b997abf92dc69e3e02bc6f/lib/arm_64bit/libVimbaCPP.so -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | avt_vimba_camera 4 | 0.0.10 5 | Wrapper of the Allied Vision Technologies (AVT) VIMBA Ethernet and Firewire SDK. 6 | 7 | Miquel Massot 8 | 9 | BSD 10 | 11 | http://wiki.ros.org/avt_vimba_ros 12 | 13 | Miquel Massot 14 | Allied Vision Technologies 15 | 16 | catkin 17 | camera_info_manager 18 | diagnostic_updater 19 | dynamic_reconfigure 20 | image_geometry 21 | image_transport 22 | message_filters 23 | roscpp 24 | sensor_msgs 25 | std_msgs 26 | polled_camera 27 | nodelet 28 | 29 | camera_info_manager 30 | diagnostic_updater 31 | dynamic_reconfigure 32 | image_geometry 33 | image_transport 34 | message_filters 35 | roscpp 36 | sensor_msgs 37 | std_msgs 38 | polled_camera 39 | nodelet 40 | 41 | image_proc 42 | stereo_image_proc 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonoCamera Nodelet 5 | 6 | 7 | 8 | 9 | StereoCamera Nodelet 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/frame_observer.cpp: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearic Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearic Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearic Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #include 34 | #include 35 | 36 | FrameObserver::FrameObserver(CameraPtr cam_ptr, Callback callback) : IFrameObserver( cam_ptr ), callback_(callback), cam_ptr_(cam_ptr) 37 | { 38 | // Nothing 39 | } 40 | 41 | void FrameObserver::FrameReceived( const FramePtr vimba_frame_ptr ) 42 | { 43 | VmbFrameStatusType eReceiveStatus; 44 | VmbErrorType err = vimba_frame_ptr->GetReceiveStatus(eReceiveStatus); 45 | 46 | if (err == VmbErrorSuccess) { 47 | switch (eReceiveStatus) 48 | { 49 | case VmbFrameStatusComplete: 50 | { 51 | // Call the callback 52 | callback_(vimba_frame_ptr); 53 | break; 54 | } 55 | case VmbFrameStatusIncomplete: 56 | { 57 | std::cout << "ERR: FrameObserver VmbFrameStatusIncomplete" << std::endl; 58 | break; 59 | } 60 | case VmbFrameStatusTooSmall: 61 | { 62 | std::cout << "ERR: FrameObserver VmbFrameStatusTooSmall" << std::endl; 63 | break; 64 | } 65 | case VmbFrameStatusInvalid: 66 | { 67 | std::cout << "ERR: FrameObserver VmbFrameStatusInvalid" << std::endl; 68 | break; 69 | } 70 | default: 71 | { 72 | std::cout << "ERR: FrameObserver no known status" << std::endl; 73 | break; 74 | } 75 | } 76 | } 77 | 78 | cam_ptr_->QueueFrame( vimba_frame_ptr ); 79 | } -------------------------------------------------------------------------------- /src/nodes/mono_camera_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char** argv) 5 | { 6 | ros::init(argc, argv, "mono_camera_node"); 7 | 8 | ros::NodeHandle nh; 9 | ros::NodeHandle nhp("~"); 10 | 11 | avt_vimba_camera::MonoCamera mc(nh,nhp); 12 | 13 | ros::spin(); 14 | return 0; 15 | } -------------------------------------------------------------------------------- /src/nodes/mono_camera_nodelet.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "avt_vimba_camera/mono_camera_nodelet.h" 3 | 4 | namespace avt_vimba_camera 5 | { 6 | void MonoCameraNodelet::onInit() 7 | { 8 | NODELET_DEBUG("Initializing nodelet..."); 9 | camera_ = new MonoCamera(getMTNodeHandle(), getMTPrivateNodeHandle()); 10 | } 11 | 12 | MonoCameraNodelet::~MonoCameraNodelet() 13 | { 14 | delete camera_; 15 | } 16 | } 17 | 18 | PLUGINLIB_EXPORT_CLASS(avt_vimba_camera::MonoCameraNodelet, nodelet::Nodelet) 19 | -------------------------------------------------------------------------------- /src/nodes/stereo_camera_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char** argv) 6 | { 7 | ros::init(argc, argv, "stereo_camera_node"); 8 | 9 | ros::NodeHandle nh; 10 | ros::NodeHandle nhp("~"); 11 | 12 | avt_vimba_camera::StereoCamera sc(nh,nhp); 13 | boost::thread stereoThread(&avt_vimba_camera::StereoCamera::run, &sc); 14 | 15 | // ROS spin 16 | ros::Rate r(10); 17 | while (ros::ok()) 18 | r.sleep(); 19 | ros::shutdown(); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /src/nodes/stereo_camera_nodelet.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "avt_vimba_camera/stereo_camera_nodelet.h" 3 | #include 4 | 5 | namespace avt_vimba_camera 6 | { 7 | void StereoCameraNodelet::onInit() 8 | { 9 | NODELET_DEBUG("Initializing nodelet..."); 10 | camera_ = new StereoCamera(getMTNodeHandle(), getMTPrivateNodeHandle()); 11 | boost::thread stereoThread(&avt_vimba_camera::StereoCamera::run, camera_); 12 | } 13 | 14 | StereoCameraNodelet::~StereoCameraNodelet() 15 | { 16 | delete camera_; 17 | } 18 | } 19 | 20 | PLUGINLIB_EXPORT_CLASS(avt_vimba_camera::StereoCameraNodelet, nodelet::Nodelet) 21 | -------------------------------------------------------------------------------- /src/nodes/sync_node.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char** argv) 6 | { 7 | ros::init(argc, argv, "sync_node"); 8 | 9 | ros::NodeHandle nh; 10 | ros::NodeHandle nhp("~"); 11 | 12 | avt_vimba_camera::Sync sync(nh,nhp); 13 | 14 | boost::thread syncThread(&avt_vimba_camera::Sync::run, &sync); 15 | 16 | // ROS spin 17 | ros::Rate r(10); 18 | while (ros::ok()) 19 | r.sleep(); 20 | 21 | ros::shutdown(); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/sync.cpp: -------------------------------------------------------------------------------- 1 | /// Copyright (c) 2014, 2 | /// Systems, Robotics and Vision Group 3 | /// University of the Balearic Islands 4 | /// All rights reserved. 5 | /// 6 | /// Redistribution and use in source and binary forms, with or without 7 | /// modification, are permitted provided that the following conditions are met: 8 | /// * Redistributions of source code must retain the above copyright 9 | /// notice, this list of conditions and the following disclaimer. 10 | /// * Redistributions in binary form must reproduce the above copyright 11 | /// notice, this list of conditions and the following disclaimer in the 12 | /// documentation and/or other materials provided with the distribution. 13 | /// * All advertising materials mentioning features or use of this software 14 | /// must display the following acknowledgement: 15 | /// This product includes software developed by 16 | /// Systems, Robotics and Vision Group, Univ. of the Balearic Islands 17 | /// * Neither the name of Systems, Robotics and Vision Group, University of 18 | /// the Balearic Islands nor the names of its contributors may be used 19 | /// to endorse or promote products derived from this software without 20 | /// specific prior written permission. 21 | /// 22 | /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | /// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | /// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | /// ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 26 | /// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | /// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | /// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 29 | /// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | /// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | /// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #include 34 | #include 35 | 36 | namespace avt_vimba_camera { 37 | 38 | Sync::Sync(ros::NodeHandle nh, ros::NodeHandle nhp): nh_(nh), nhp_(nhp), init_(false), it_(nh) 39 | { 40 | // Read params 41 | nhp_.param("camera", camera_, string("/stereo_down")); 42 | nhp_.param("timer_period", timer_period_, 10.0); 43 | nhp_.param("max_unsync_time", max_unsync_time_, 5.0); 44 | } 45 | 46 | void Sync::run() 47 | { 48 | // Create the approximate sync subscriber 49 | image_transport::SubscriberFilter left_sub, right_sub; 50 | message_filters::Subscriber left_info_sub, right_info_sub; 51 | 52 | left_sub .subscribe(it_, camera_+"/left/image_raw", 5); 53 | right_sub .subscribe(it_, camera_+"/right/image_raw", 5); 54 | left_info_sub .subscribe(nh_, camera_+"/left/camera_info", 5); 55 | right_info_sub.subscribe(nh_, camera_+"/right/camera_info", 5); 56 | 57 | boost::shared_ptr sync_var; 58 | sync_var.reset(new SyncType(SyncPolicy(5), left_sub, right_sub, left_info_sub, right_info_sub) ); 59 | sync_var->registerCallback(bind(&Sync::msgsCallback, this, _1, _2, _3, _4)); 60 | 61 | // Sync timer 62 | sync_timer_ = nh_.createTimer(ros::Duration(timer_period_), &Sync::syncCallback, this); 63 | 64 | // Publish info 65 | pub_info_ = nhp_.advertise("info", 1, true); 66 | 67 | ros::spin(); 68 | } 69 | 70 | void Sync::msgsCallback(const sensor_msgs::ImageConstPtr& l_img_msg, 71 | const sensor_msgs::ImageConstPtr& r_img_msg, 72 | const sensor_msgs::CameraInfoConstPtr& l_info_msg, 73 | const sensor_msgs::CameraInfoConstPtr& r_info_msg) 74 | { 75 | if (!init_) 76 | ROS_INFO("[SyncNode]: Initialized."); 77 | init_ = true; 78 | 79 | last_ros_sync_ = ros::Time::now().toSec(); 80 | } 81 | 82 | void Sync::syncCallback(const ros::TimerEvent&) 83 | { 84 | if (!init_) return; 85 | 86 | double now = ros::Time::now().toSec(); 87 | 88 | // Check desired frequency 89 | if (now - last_ros_sync_ > max_unsync_time_) 90 | { 91 | // No sync! 92 | ROS_WARN_STREAM("[SyncNode]: No sync during " << now - last_ros_sync_ << " sec."); 93 | 94 | // Publish info 95 | std_msgs::String msg; 96 | msg.data = "Reseting camera driver at ROSTIME: " + 97 | boost::lexical_cast(now) + "s."; 98 | pub_info_.publish(msg); 99 | } 100 | } 101 | 102 | 103 | }; 104 | --------------------------------------------------------------------------------