├── lib ├── 64bit │ ├── libVimbaC.so │ └── libVimbaCPP.so ├── arm_32bit │ ├── libVimbaC.so │ └── libVimbaCPP.so └── arm_64bit │ ├── libVimbaC.so │ └── libVimbaCPP.so ├── include ├── VimbaC │ └── Include │ │ └── VmbCommonTypes.h ├── VimbaCPP │ ├── Source │ │ ├── Version.h │ │ ├── BasicLockable.cpp │ │ ├── Helper.h │ │ ├── FrameImpl.h │ │ ├── Clock.h │ │ ├── MutexGuard.h │ │ ├── CommandFeature.h │ │ ├── Semaphore.h │ │ ├── StringFeature.h │ │ ├── RawFeature.h │ │ ├── Condition.h │ │ ├── BoolFeature.cpp │ │ ├── CommandFeature.cpp │ │ ├── FloatFeature.h │ │ ├── IntFeature.h │ │ ├── FrameHandler.h │ │ ├── DefaultCameraFactory.h │ │ ├── DefaultCameraFactory.cpp │ │ ├── BoolFeature.h │ │ ├── StringFeature.cpp │ │ ├── Mutex.cpp │ │ ├── Semaphore.cpp │ │ ├── ConditionHelper.h │ │ ├── FrameHandler.cpp │ │ ├── MutexGuard.cpp │ │ ├── RawFeature.cpp │ │ ├── EnumFeature.h │ │ ├── IntFeature.cpp │ │ ├── Condition.cpp │ │ ├── AncillaryData.cpp │ │ ├── ConditionHelper.cpp │ │ ├── FloatFeature.cpp │ │ ├── Clock.cpp │ │ └── FileLogger.cpp │ └── Include │ │ ├── VimbaCPP.h │ │ ├── Mutex.h │ │ ├── FileLogger.h │ │ ├── BasicLockable.h │ │ ├── UserLoggerDefines.h │ │ ├── LoggerDefines.h │ │ ├── IFeatureObserver.h │ │ ├── FeatureContainer.hpp │ │ ├── IFrameObserver.h │ │ ├── VimbaCPPCommon.h │ │ ├── IInterfaceListObserver.h │ │ ├── ICameraListObserver.h │ │ ├── VimbaSystem.hpp │ │ ├── SharedPointerDefines.h │ │ ├── ICameraFactory.h │ │ ├── AncillaryData.h │ │ ├── FeatureContainer.h │ │ ├── Interface.hpp │ │ ├── UserSharedPointerDefines.h │ │ ├── SharedPointer.h │ │ ├── Interface.h │ │ └── EnumEntry.hpp └── avt_vimba_camera │ ├── mono_camera_nodelet.h │ ├── trigger.h │ ├── frame_observer.h │ ├── mono_camera.h │ └── avt_vimba_camera.h ├── src ├── nodes │ ├── trigger_node.cpp │ ├── mono_camera_node.cpp │ └── mono_camera_nodelet.cpp ├── frame_observer.cpp └── trigger.cpp ├── plugins.xml ├── .gitignore ├── calibrations └── calibration_example.yaml ├── launch ├── trigger_node.launch ├── Mako_G-319.launch └── stereo_camera.launch ├── .circleci └── config.yml ├── package.xml ├── LICENSE.md └── CMakeLists.txt /lib/64bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/64bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/64bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/64bit/libVimbaCPP.so -------------------------------------------------------------------------------- /lib/arm_32bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/arm_32bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/arm_64bit/libVimbaC.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/arm_64bit/libVimbaC.so -------------------------------------------------------------------------------- /lib/arm_32bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/arm_32bit/libVimbaCPP.so -------------------------------------------------------------------------------- /lib/arm_64bit/libVimbaCPP.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/lib/arm_64bit/libVimbaCPP.so -------------------------------------------------------------------------------- /include/VimbaC/Include/VmbCommonTypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/astuff/avt_vimba_camera/HEAD/include/VimbaC/Include/VmbCommonTypes.h -------------------------------------------------------------------------------- /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 8 6 | #define VIMBACPP_VERSION_PATCH 4 7 | 8 | #endif //AVT_VMBAPI_VERSION_H 9 | -------------------------------------------------------------------------------- /src/nodes/trigger_node.cpp: -------------------------------------------------------------------------------- 1 | #include "avt_vimba_camera/trigger.h" 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | ros::init(argc, argv, "trigger_node"); 6 | 7 | trigger::Trigger trigger; 8 | trigger.Init(); 9 | 10 | ros::spin(); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonoCamera Nodelet 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /include/avt_vimba_camera/mono_camera_nodelet.h: -------------------------------------------------------------------------------- 1 | #include "avt_vimba_camera/mono_camera.h" 2 | 3 | #include 4 | 5 | namespace avt_vimba_camera 6 | { 7 | class MonoCameraNodelet : public nodelet::Nodelet 8 | { 9 | public: 10 | virtual void onInit(); 11 | virtual ~MonoCameraNodelet(); 12 | 13 | private: 14 | MonoCamera* camera_; 15 | }; 16 | 17 | } // namespace avt_vimba_camera 18 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | } // namespace avt_vimba_camera 17 | 18 | PLUGINLIB_EXPORT_CLASS(avt_vimba_camera::MonoCameraNodelet, nodelet::Nodelet) 19 | -------------------------------------------------------------------------------- /calibrations/calibration_example.yaml: -------------------------------------------------------------------------------- 1 | # NOTE: This is just an example calibration file, always use your own calibration when doing any image rectification or un-distortion. 2 | 3 | image_width: 1920 4 | image_height: 1440 5 | camera_name: camera 6 | camera_matrix: 7 | rows: 3 8 | cols: 3 9 | data: [1477.37610504879, 0, 966.3836593155506, 0, 1470.959845844984, 721.682892292772, 0, 0, 1] 10 | distortion_model: rational_polynomial 11 | distortion_coefficients: 12 | rows: 1 13 | cols: 8 14 | data: [0.1424740048592687, 2.048769427985746, 0.0008456231435827007, -0.0004816724796356829, -2.834810741450366, -0.1613802969459177, 1.425388415204544, -2.584546591478115] 15 | rectification_matrix: 16 | rows: 3 17 | cols: 3 18 | data: [0.9905132663703519, -0.003683047506279885, 0.1373677702570837, 0.002297487443287912, 0.9999448926725898, 0.01024368925000131, -0.1373979282805399, -0.009830909371423568, 0.9904671435868766] 19 | projection_matrix: 20 | rows: 3 21 | cols: 4 22 | data: [2046.340398990372, 0, 720.5770225524902, 0, 0, 2046.340398990372, 710.3249855041504, 0, 0, 0, 1, 0] 23 | -------------------------------------------------------------------------------- /launch/trigger_node.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | commands: 4 | ros_build: 5 | steps: 6 | - checkout 7 | - run: 8 | name: Set Up Container 9 | command: | 10 | apt-get update -qq 11 | source /opt/ros/*/setup.bash 12 | mkdir -p ~/catkin_ws/src 13 | ln -s "$PWD" ~/catkin_ws/src/ 14 | cd ~/catkin_ws 15 | rosdep update && rosdep install --from-paths src/ --ignore-src -y 16 | catkin init 17 | catkin config --extend /opt/ros/$ROS_DISTRO 18 | - run: 19 | name: Build 20 | command: | 21 | source /opt/ros/*/setup.bash 22 | cd ~/catkin_ws 23 | catkin build -j 2 --no-status 24 | - run: 25 | name: Run Tests 26 | command: | 27 | source /opt/ros/*/setup.bash 28 | cd ~/catkin_ws 29 | catkin run_tests avt_vimba_camera --no-deps 30 | catkin_test_results 31 | jobs: 32 | noetic: 33 | docker: 34 | - image: autonomoustuff/docker-builds:noetic-ros-base 35 | steps: 36 | - ros_build 37 | working_directory: ~/src 38 | 39 | workflows: 40 | ros_build: 41 | jobs: 42 | - noetic 43 | -------------------------------------------------------------------------------- /include/avt_vimba_camera/trigger.h: -------------------------------------------------------------------------------- 1 | #ifndef AVT_VIMBA_CAMERA_TRIGGER_H 2 | #define AVT_VIMBA_CAMERA_TRIGGER_H 3 | 4 | #include "VimbaCPP/Include/VimbaCPP.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace trigger 13 | { 14 | class Trigger 15 | { 16 | public: 17 | Trigger(); 18 | ~Trigger(); 19 | 20 | void Init(); 21 | 22 | private: 23 | void LoadParams(); 24 | void InitializeAddress(); 25 | bool PrepareActionCommand(); 26 | bool SetIntFeatureValue(const std::string& name, int64_t value); 27 | 28 | void TimerCb(const ros::TimerEvent& event); 29 | void TriggerCb(const std_msgs::Bool::ConstPtr& msg); 30 | void SendActionCommand(); 31 | 32 | AVT::VmbAPI::VimbaSystem& vimba_system_; 33 | AVT::VmbAPI::InterfacePtr interface_ptr_; 34 | 35 | ros::NodeHandle pnh_; 36 | ros::NodeHandle nh_; 37 | 38 | ros::Timer trigger_timer_; 39 | ros::Subscriber trigger_sub_; 40 | 41 | // Params 42 | struct in_addr destination_ip_; 43 | std::string trigger_src_; 44 | float timer_period_; 45 | int action_device_key_; 46 | int action_group_key_; 47 | int action_group_mask_; 48 | }; 49 | 50 | } // namespace trigger 51 | 52 | #endif // AVT_VIMBA_CAMERA_TRIGGER_H 53 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | avt_vimba_camera 4 | 1.2.0 5 | Camera driver for Allied Vision Technologies (AVT) cameras, based on their Vimba SDK. 6 | BSD 7 | 8 | https://github.com/astuff/avt_vimba_camera 9 | https://github.com/astuff/avt_vimba_camera 10 | https://github.com/astuff/avt_vimba_camera/issues 11 | 12 | Allied Vision Technologies 13 | Miquel Massot 14 | AutonomouStuff Software Team 15 | 16 | catkin 17 | camera_info_manager 18 | diagnostic_updater 19 | dynamic_reconfigure 20 | image_transport 21 | message_filters 22 | roscpp 23 | sensor_msgs 24 | std_msgs 25 | nodelet 26 | 27 | image_proc 28 | stereo_image_proc 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /launch/Mako_G-319.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 | -------------------------------------------------------------------------------- /launch/stereo_camera.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 | -------------------------------------------------------------------------------- /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/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 | 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 | namespace AVT { 32 | namespace VmbAPI { 33 | 34 | BasicLockable::BasicLockable() 35 | : m_pMutex( MutexPtr( new Mutex() )) 36 | { 37 | } 38 | 39 | BasicLockable::~BasicLockable() 40 | { 41 | } 42 | 43 | BasicLockable::BasicLockable( MutexPtr pMutex ) 44 | : m_pMutex( pMutex ) 45 | { 46 | } 47 | 48 | MutexPtr& BasicLockable::GetMutex() 49 | { 50 | return m_pMutex; 51 | } 52 | const MutexPtr& BasicLockable::GetMutex() const 53 | { 54 | return m_pMutex; 55 | } 56 | 57 | }} //namespace AVT::VmbAPI 58 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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 | 46 | bool m_bAlreadyAnnounced; 47 | bool m_bAlreadyQueued; 48 | 49 | void Init(); 50 | }; 51 | 52 | }} 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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(); 50 | bool Release(); 51 | 52 | protected: 53 | Mutex *m_pMutex; 54 | }; 55 | 56 | } //namespace VmbAPI 57 | } //namespace AVT 58 | 59 | #endif //AVT_VMBAPI_MUTEXGUARD 60 | -------------------------------------------------------------------------------- /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 | 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_MUTEX 29 | #define AVT_VMBAPI_MUTEX 30 | 31 | #include 32 | 33 | #ifdef _WIN32 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | namespace AVT { 40 | namespace VmbAPI { 41 | 42 | class Mutex 43 | { 44 | public: 45 | IMEXPORT explicit Mutex( bool bInitLock = false ); 46 | IMEXPORT ~Mutex(); 47 | 48 | IMEXPORT void Lock(); 49 | IMEXPORT void Unlock(); 50 | 51 | protected: 52 | #ifdef _WIN32 53 | HANDLE m_hMutex; 54 | #else 55 | pthread_mutex_t m_Mutex; 56 | #endif 57 | 58 | private: 59 | Mutex& operator=( const Mutex& ); 60 | Mutex( const Mutex& ); 61 | }; 62 | 63 | }} //namespace AVT::VmbAPI 64 | 65 | #endif //AVT_VMBAPI_MUTEX 66 | -------------------------------------------------------------------------------- /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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | 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_BASICLOCKABLE 29 | #define AVT_VMBAPI_BASICLOCKABLE 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace AVT { 36 | namespace VmbAPI { 37 | 38 | class BasicLockable 39 | { 40 | public: 41 | IMEXPORT BasicLockable(); 42 | IMEXPORT BasicLockable( MutexPtr pMutex ); 43 | 44 | IMEXPORT virtual ~BasicLockable(); 45 | 46 | MutexPtr& GetMutex(); 47 | const 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/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 | Intended for use in the implementation of Vimba CPP API. 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.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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 "VimbaC/Include/VmbCommonTypes.h" 34 | #include "VimbaCPP/Include/BasicLockable.h" 35 | #include "VimbaCPP/Include/SharedPointerDefines.h" 36 | #include "VimbaCPP/Include/Frame.h" 37 | #include "VimbaCPP/Include/IFrameObserver.h" 38 | #include "VimbaCPP/Include/Mutex.h" 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 | MutexPtr& Mutex() { return m_pMutex; } 54 | private: 55 | IFrameObserverPtr m_pObserver; 56 | FramePtr m_pFrame; 57 | MutexPtr m_pMutex; 58 | }; 59 | 60 | typedef std::vector FrameHandlerPtrVector; 61 | 62 | }} // namespace AVT::VmbAPI 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /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 | 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_LOGGERDEFINES_H 29 | #define AVT_VMBAPI_LOGGERDEFINES_H 30 | 31 | #include 32 | 33 | #ifndef USER_LOGGER 34 | 35 | #include 36 | 37 | namespace AVT { 38 | namespace VmbAPI { 39 | 40 | #define LOGGER_DECL FileLogger 41 | #define LOGGER_DEF FileLogger( "VimbaCPP.log", true ) 42 | #define LOGGER_LOG( logger, loggingInfo ) if ( NULL != (logger) ) (logger)->Log( loggingInfo ); 43 | 44 | 45 | // These are all uses of LOGGER_DECL logger declarations 46 | typedef LOGGER_DECL* Logger; 47 | 48 | }} 49 | 50 | #else 51 | #include 52 | #endif 53 | 54 | #include 55 | 56 | #define LOG_FREE_TEXT( txt ) std::string strExc( txt );\ 57 | strExc.append( " in function: " );\ 58 | strExc.append( __FUNCTION__ );\ 59 | LOGGER_LOG( VimbaSystem::GetInstance().GetLogger(), strExc ); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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/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 | 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_FEATURECONTAINER_HPP 30 | #define AVT_VMBAPI_FEATURECONTAINER_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: Once queried this information remains static throughout the object's lifetime 38 | inline VmbErrorType FeatureContainer::GetFeatures( FeaturePtrVector &features ) 39 | { 40 | VmbErrorType res; 41 | VmbUint32_t nSize; 42 | 43 | res = GetFeatures( NULL, nSize ); 44 | if ( VmbErrorSuccess == res ) 45 | { 46 | if( 0 != nSize) 47 | { 48 | try 49 | { 50 | FeaturePtrVector tmpFeatures( nSize ); 51 | res = GetFeatures( &tmpFeatures[0], nSize ); 52 | if( VmbErrorSuccess == res) 53 | { 54 | features.swap( tmpFeatures ); 55 | } 56 | } 57 | catch(...) 58 | { 59 | return VmbErrorResources; 60 | } 61 | } 62 | else 63 | { 64 | features.clear(); 65 | } 66 | } 67 | 68 | return res; 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | 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 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | Mutex::Mutex( bool bInitLock ) 37 | #ifdef WIN32 38 | : m_hMutex( NULL ) 39 | #endif 40 | { 41 | #ifdef WIN32 42 | m_hMutex = CreateMutex( NULL, FALSE, NULL ); 43 | if( NULL == m_hMutex ) 44 | { 45 | LOG_FREE_TEXT( "Could not create mutex." ); 46 | throw std::bad_alloc(); 47 | } 48 | #else 49 | pthread_mutex_init(&m_Mutex, NULL); 50 | #endif 51 | 52 | if( true == bInitLock ) 53 | { 54 | Lock(); 55 | } 56 | } 57 | 58 | Mutex::~Mutex() 59 | { 60 | #ifdef WIN32 61 | CloseHandle( m_hMutex ); 62 | #else 63 | pthread_mutex_destroy(&m_Mutex); 64 | #endif 65 | } 66 | 67 | Mutex::Mutex( const Mutex& ) 68 | { 69 | // No copy ctor 70 | } 71 | 72 | Mutex& Mutex::operator=( const Mutex& ) 73 | { 74 | // No assignment operator 75 | return *this; 76 | } 77 | 78 | void Mutex::Lock() 79 | { 80 | #ifdef WIN32 81 | WaitForSingleObject( m_hMutex, INFINITE ); 82 | #else 83 | pthread_mutex_lock( &m_Mutex ); 84 | #endif 85 | } 86 | 87 | void Mutex::Unlock() 88 | { 89 | #ifdef WIN32 90 | ReleaseMutex( m_hMutex ); 91 | #else 92 | pthread_mutex_unlock( &m_Mutex ); 93 | #endif 94 | } 95 | 96 | }} //namespace AVT::VmbAPI 97 | -------------------------------------------------------------------------------- /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 | typedef std::function Callback; 46 | 47 | // We pass the camera that will deliver the frames to the constructor 48 | FrameObserver(CameraPtr cam_ptr, Callback callback); 49 | 50 | // Destructor 51 | ~FrameObserver(){}; 52 | 53 | // This is our callback routine that will be executed on every received frame 54 | virtual void FrameReceived(const FramePtr vimba_frame_ptr); 55 | 56 | private: 57 | // Frame observer stores all FramePtr 58 | CameraPtr cam_ptr_; 59 | Callback callback_; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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/Include/VimbaCPPCommon.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Copyright (C) 2012 - 2017 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, // A new camera was discovered by Vimba 57 | UpdateTriggerPluggedOut = 1, // A camera has disappeared from the bus 58 | UpdateTriggerOpenStateChanged = 3 // The possible opening mode of a camera has changed (e.g., because it was opened by another application) 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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/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 "VimbaCPP/Source/FrameHandler.h" 29 | 30 | #include "VimbaCPP/Include/LoggerDefines.h" 31 | #include "VimbaCPP/Source/MutexGuard.h" 32 | 33 | namespace AVT { 34 | namespace VmbAPI { 35 | 36 | FrameHandler::FrameHandler( FramePtr pFrame, IFrameObserverPtr pFrameObserver ) 37 | : m_pFrame( pFrame ) 38 | , m_pObserver( pFrameObserver ) 39 | , m_pMutex( new AVT::VmbAPI::Mutex() ) 40 | { 41 | } 42 | 43 | FramePtr FrameHandler::GetFrame() const 44 | { 45 | return m_pFrame; 46 | } 47 | 48 | void VMB_CALL FrameHandler::FrameDoneCallback( const VmbHandle_t /*handle*/, VmbFrame_t *pVmbFrame ) 49 | { 50 | if ( NULL != pVmbFrame ) 51 | { 52 | FrameHandler* pFrameHandler = reinterpret_cast( pVmbFrame->context[FRAME_HDL] ); 53 | if ( NULL != pFrameHandler) 54 | { 55 | // Begin read lock frame handler 56 | MutexGuard local_lock( pFrameHandler->Mutex() ); 57 | { 58 | IFrameObserverPtr pObs; 59 | if ( true == SP_ACCESS( pFrameHandler->m_pFrame )->GetObserver( pObs )) 60 | { 61 | SP_ACCESS( pObs )->FrameReceived( pFrameHandler->m_pFrame ); 62 | } 63 | }// scope to destroy observer pointer before releasing the lock 64 | } 65 | else // No FrameHandler 66 | { 67 | LOG_FREE_TEXT( "No frame handler passed. Frame has been removed from the frame queue." ) 68 | } 69 | } 70 | else // pVmbFrame == NULL (Just for safety) 71 | { 72 | LOG_FREE_TEXT( "Received callback for already freed frame." ) 73 | } 74 | } 75 | 76 | }} 77 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Original license from upstream repo: 2 | 3 | Copyright (c) 2014, 4 | Systems, Robotics and Vision Group 5 | University of the Balearican Islands 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * All advertising materials mentioning features or use of this software 16 | must display the following acknowledgement: 17 | This product includes software developed by 18 | Systems, Robotics and Vision Group, Univ. of the Balearican Islands 19 | * Neither the name of Systems, Robotics and Vision Group, University of 20 | the Balearican Islands nor the names of its contributors may be used 21 | to endorse or promote products derived from this software without 22 | specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | # AutonomouStuff fork contributions 36 | 37 | Any additional contributions to this fork made by AutonomouStuff or contributors are licensed under MIT as follows: 38 | 39 | MIT License 40 | 41 | Copyright (c) 2019 AutonomouStuff 42 | 43 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 44 | 45 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 46 | 47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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 | : m_pMutex( NULL ) 38 | { 39 | } 40 | 41 | MutexGuard::MutexGuard( MutexPtr &pMutex ) 42 | { 43 | if ( SP_ISNULL( pMutex )) 44 | { 45 | LOG_FREE_TEXT( "No mutex passed." ); 46 | } 47 | else 48 | { 49 | m_pMutex = SP_ACCESS(pMutex ); 50 | Protect( ); 51 | } 52 | } 53 | 54 | MutexGuard::MutexGuard( BasicLockablePtr pLockable ) 55 | { 56 | if ( SP_ISNULL( pLockable )) 57 | { 58 | LOG_FREE_TEXT( "No mutex passed." ); 59 | } 60 | else 61 | { 62 | m_pMutex = SP_ACCESS(SP_ACCESS(pLockable)->GetMutex()); 63 | Protect( ); 64 | } 65 | } 66 | 67 | MutexGuard::MutexGuard( const BasicLockable &rLockable ) 68 | { 69 | m_pMutex = SP_ACCESS(rLockable.GetMutex() ); 70 | Protect( ); 71 | } 72 | 73 | MutexGuard::~MutexGuard() 74 | { 75 | Release(); 76 | } 77 | 78 | void MutexGuard::Protect( ) 79 | { 80 | if( m_pMutex == NULL ) 81 | { 82 | LOG_FREE_TEXT( "No mutex passed." ); 83 | return; 84 | } 85 | m_pMutex->Lock(); 86 | } 87 | 88 | 89 | bool MutexGuard::Release() 90 | { 91 | if( m_pMutex == NULL) 92 | { 93 | return false; 94 | } 95 | 96 | m_pMutex ->Unlock(); 97 | m_pMutex = NULL; 98 | 99 | return true; 100 | } 101 | 102 | }} //namespace AVT::VmbAPI 103 | -------------------------------------------------------------------------------- /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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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 | -------------------------------------------------------------------------------- /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) 37 | : IFrameObserver(cam_ptr), callback_(callback), cam_ptr_(cam_ptr) 38 | { 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 | { 48 | switch (eReceiveStatus) 49 | { 50 | case VmbFrameStatusComplete: { 51 | // Call the callback 52 | callback_(vimba_frame_ptr); 53 | break; 54 | } 55 | case VmbFrameStatusIncomplete: { 56 | std::cout << "ERR: FrameObserver VmbFrameStatusIncomplete" << std::endl; 57 | break; 58 | } 59 | case VmbFrameStatusTooSmall: { 60 | std::cout << "ERR: FrameObserver VmbFrameStatusTooSmall" << std::endl; 61 | break; 62 | } 63 | case VmbFrameStatusInvalid: { 64 | std::cout << "ERR: FrameObserver VmbFrameStatusInvalid" << std::endl; 65 | break; 66 | } 67 | default: { 68 | std::cout << "ERR: FrameObserver no known status" << std::endl; 69 | break; 70 | } 71 | } 72 | } 73 | 74 | cam_ptr_->QueueFrame(vimba_frame_ptr); 75 | } 76 | -------------------------------------------------------------------------------- /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 | { 51 | class MonoCamera 52 | { 53 | public: 54 | MonoCamera(ros::NodeHandle& nh, ros::NodeHandle& nhp); 55 | ~MonoCamera(void); 56 | 57 | private: 58 | AvtVimbaApi api_; 59 | AvtVimbaCamera cam_; 60 | 61 | ros::NodeHandle nh_; 62 | ros::NodeHandle nhp_; 63 | 64 | std::string ip_; 65 | std::string guid_; 66 | std::string camera_info_url_; 67 | std::string frame_id_; 68 | bool print_all_features_; 69 | bool use_measurement_time_; 70 | int32_t ptp_offset_; 71 | 72 | image_transport::ImageTransport it_; 73 | image_transport::CameraPublisher pub_; 74 | 75 | std::shared_ptr info_man_; 76 | 77 | // Dynamic reconfigure 78 | typedef avt_vimba_camera::AvtVimbaCameraConfig Config; 79 | typedef dynamic_reconfigure::Server ReconfigureServer; 80 | ReconfigureServer reconfigure_server_{nhp_}; 81 | 82 | // Camera configuration 83 | Config camera_config_; 84 | 85 | void frameCallback(const FramePtr& vimba_frame_ptr); 86 | void configure(Config& newconfig, uint32_t level); 87 | void updateCameraInfo(const Config& config); 88 | }; 89 | } // namespace avt_vimba_camera 90 | #endif 91 | -------------------------------------------------------------------------------- /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 | 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_VIMBASYSTEM_HPP 29 | #define AVT_VMBAPI_VIMBASYSTEM_HPP 30 | 31 | // 32 | // Inline wrapper functions that allocate memory for STL objects in the application's context 33 | // and to pass data across DLL boundaries using arrays 34 | // 35 | inline VmbErrorType VimbaSystem::GetInterfaces( InterfacePtrVector &rInterfaces ) 36 | { 37 | VmbErrorType res; 38 | VmbUint32_t nSize; 39 | 40 | res = GetInterfaces( NULL, nSize ); 41 | if ( VmbErrorSuccess == res ) 42 | { 43 | if( 0 != nSize) 44 | { 45 | try 46 | { 47 | InterfacePtrVector tmpInterfaces( nSize ); 48 | res = GetInterfaces( &tmpInterfaces[0], nSize ); 49 | if( VmbErrorSuccess == res ) 50 | { 51 | rInterfaces.swap( tmpInterfaces); 52 | } 53 | } 54 | catch(...) 55 | { 56 | return VmbErrorResources; 57 | } 58 | } 59 | else 60 | { 61 | rInterfaces.clear(); 62 | } 63 | } 64 | 65 | return res; 66 | } 67 | 68 | inline VmbErrorType VimbaSystem::GetCameras( CameraPtrVector &rCameras ) 69 | { 70 | VmbErrorType res; 71 | VmbUint32_t nSize; 72 | 73 | res = GetCameras( NULL, nSize ); 74 | if ( VmbErrorSuccess == res) 75 | { 76 | if( 0 != nSize) 77 | { 78 | try 79 | { 80 | CameraPtrVector tmpCameras( nSize ); 81 | res = GetCameras( &tmpCameras[0], nSize ); 82 | if( VmbErrorSuccess == res ) 83 | { 84 | if( nSize < tmpCameras.size() ) 85 | { 86 | tmpCameras.resize( nSize); 87 | } 88 | rCameras.swap( tmpCameras ); 89 | } 90 | } 91 | catch(...) 92 | { 93 | return VmbErrorResources; 94 | } 95 | } 96 | else 97 | { 98 | rCameras.clear(); 99 | } 100 | } 101 | 102 | return res; 103 | } 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /src/trigger.cpp: -------------------------------------------------------------------------------- 1 | #include "avt_vimba_camera/trigger.h" 2 | 3 | namespace trigger 4 | { 5 | Trigger::Trigger() : vimba_system_(AVT::VmbAPI::VimbaSystem::GetInstance()), pnh_("~") 6 | { 7 | } 8 | 9 | Trigger::~Trigger() 10 | { 11 | vimba_system_.Shutdown(); 12 | } 13 | 14 | void Trigger::Init() 15 | { 16 | VmbErrorType return_value = vimba_system_.Startup(); 17 | 18 | if (return_value != VmbErrorSuccess) 19 | { 20 | ROS_ERROR_STREAM("Failed to start Vimba system, vimba error code: " << return_value); 21 | ros::shutdown(); 22 | } 23 | 24 | LoadParams(); 25 | InitializeAddress(); 26 | 27 | if (trigger_src_ == "timer") 28 | { 29 | trigger_timer_ = nh_.createTimer(ros::Duration(timer_period_), &Trigger::TimerCb, this); 30 | } 31 | else if (trigger_src_ == "subscriber") 32 | { 33 | trigger_sub_ = nh_.subscribe("trigger_input", 10, &Trigger::TriggerCb, this); 34 | } 35 | else 36 | { 37 | ROS_ERROR("Unknown trigger_src %s", trigger_src_.c_str()); 38 | ros::shutdown(); 39 | } 40 | } 41 | 42 | void Trigger::LoadParams() 43 | { 44 | std::string destination_ip; 45 | pnh_.param("destination_ip", destination_ip, "192.168.3.40"); 46 | pnh_.param("trigger_src", trigger_src_, "timer"); 47 | pnh_.param("timer_period", timer_period_, 0.1); 48 | pnh_.param("action_device_key", action_device_key_, 1); 49 | pnh_.param("action_group_key", action_group_key_, 1); 50 | pnh_.param("action_group_mask", action_group_mask_, 1); 51 | 52 | if (inet_aton(destination_ip.c_str(), &destination_ip_) == 0) 53 | { 54 | ROS_ERROR("Unable to parse desination_ip: %s", destination_ip.c_str()); 55 | ros::shutdown(); 56 | } 57 | } 58 | 59 | void Trigger::InitializeAddress() 60 | { 61 | VmbErrorType return_value = VmbErrorSuccess; 62 | 63 | if (!SetIntFeatureValue("GevActionDestinationIPAddress", destination_ip_.s_addr)) 64 | { 65 | ROS_ERROR("Could not set destination address"); 66 | } 67 | 68 | ROS_INFO("Destination address set"); 69 | } 70 | 71 | bool Trigger::PrepareActionCommand() 72 | { 73 | return (SetIntFeatureValue("ActionDeviceKey", action_device_key_) && SetIntFeatureValue("ActionGroupKey", action_group_key_) && 74 | SetIntFeatureValue("ActionGroupMask", action_group_mask_)); 75 | } 76 | 77 | // Sets an integer feature value on the vimba system 78 | bool Trigger::SetIntFeatureValue(const std::string& name, int64_t value) 79 | { 80 | VmbErrorType return_value = VmbErrorSuccess; 81 | 82 | AVT::VmbAPI::FeaturePtr feature_ptr; 83 | return_value = vimba_system_.GetFeatureByName(name.c_str(), feature_ptr); 84 | 85 | if (return_value != VmbErrorSuccess) 86 | { 87 | ROS_ERROR_STREAM("Failed to get feature, vimba error code: " << return_value); 88 | return false; 89 | } 90 | else 91 | { 92 | return_value = feature_ptr->SetValue((VmbInt64_t)value); 93 | } 94 | 95 | return (return_value == VmbErrorSuccess); 96 | } 97 | 98 | void Trigger::TimerCb(const ros::TimerEvent& event) 99 | { 100 | SendActionCommand(); 101 | } 102 | 103 | void Trigger::TriggerCb(const std_msgs::Bool::ConstPtr& msg) 104 | { 105 | SendActionCommand(); 106 | } 107 | 108 | void Trigger::SendActionCommand() 109 | { 110 | if (!PrepareActionCommand()) 111 | { 112 | ROS_ERROR_THROTTLE(1.0, "Failed to prepare action command"); 113 | return; 114 | } 115 | 116 | VmbErrorType return_value = VmbErrorSuccess; 117 | 118 | AVT::VmbAPI::FeaturePtr lFeature; 119 | return_value = vimba_system_.GetFeatureByName("ActionCommand", lFeature); 120 | 121 | if (return_value == VmbErrorSuccess) 122 | { 123 | return_value = lFeature->RunCommand(); 124 | } 125 | 126 | if (return_value == VmbErrorSuccess) 127 | { 128 | ROS_DEBUG("Action command sent"); 129 | } 130 | else 131 | { 132 | ROS_ERROR_THROTTLE(1.0, "Failed to send action command"); 133 | } 134 | } 135 | 136 | } // namespace trigger 137 | -------------------------------------------------------------------------------- /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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | Intended for use in the implementation of Vimba CPP API. 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/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 | 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_SHAREDPOINTERDEFINES_H 30 | #define AVT_VMBAPI_SHAREDPOINTERDEFINES_H 31 | 32 | // 33 | // If your version of STL does not provide a shared pointer implementation please see UserSharedPointerDefines.h for information on 34 | // how to use another shared pointer than std::shared_ptr. 35 | // 36 | 37 | #ifndef USER_SHARED_POINTER 38 | 39 | #include 40 | 41 | namespace AVT { 42 | namespace VmbAPI { 43 | 44 | #define SP_DECL( T ) AVT::VmbAPI::shared_ptr 45 | #define SP_SET( sp, rawPtr ) (sp).reset( (rawPtr) ) 46 | #define SP_RESET( sp ) (sp).reset() 47 | #define SP_ISEQUAL( sp1, sp2 ) ( (sp1) == (sp2) ) 48 | #define SP_ISNULL( sp ) ( NULL == (sp) ) 49 | #define SP_ACCESS( sp ) (sp).get() 50 | #define SP_DYN_CAST( sp, T ) AVT::VmbAPI::dynamic_pointer_cast(sp) 51 | 52 | // These are all uses of a SP_DECL shared_ptr declaration 53 | class Interface; 54 | typedef SP_DECL( Interface ) InterfacePtr; 55 | 56 | class Camera; 57 | typedef SP_DECL( Camera ) CameraPtr; 58 | 59 | class Feature; 60 | typedef SP_DECL( Feature ) FeaturePtr; 61 | 62 | class FeatureContainer; 63 | typedef SP_DECL( FeatureContainer ) FeatureContainerPtr; 64 | 65 | class IFeatureObserver; 66 | typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr; 67 | 68 | class Frame; 69 | typedef SP_DECL( Frame ) FramePtr; 70 | 71 | class FrameHandler; 72 | typedef SP_DECL( FrameHandler ) FrameHandlerPtr; 73 | 74 | class IFrameObserver; 75 | typedef SP_DECL( IFrameObserver ) IFrameObserverPtr; 76 | 77 | class AncillaryData; 78 | typedef SP_DECL( AncillaryData ) AncillaryDataPtr; 79 | typedef SP_DECL( const AncillaryData ) ConstAncillaryDataPtr; 80 | 81 | class ICameraFactory; 82 | typedef SP_DECL( ICameraFactory ) ICameraFactoryPtr; 83 | 84 | class ICameraListObserver; 85 | typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr; 86 | 87 | class IInterfaceListObserver; 88 | typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr; 89 | 90 | class Mutex; 91 | typedef SP_DECL( Mutex ) MutexPtr; 92 | 93 | class BasicLockable; 94 | typedef SP_DECL( BasicLockable ) BasicLockablePtr; 95 | 96 | }} 97 | 98 | #else 99 | #include 100 | #endif 101 | 102 | 103 | #endif // AVT_VMBAPI_SHAREDPOINTERDEFINES_H 104 | -------------------------------------------------------------------------------- /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/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 | Intended for use in the implementation of Vimba CPP API. 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/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/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 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(avt_vimba_camera) 3 | 4 | find_package(catkin REQUIRED COMPONENTS 5 | camera_info_manager 6 | diagnostic_updater 7 | dynamic_reconfigure 8 | image_transport 9 | message_filters 10 | roscpp 11 | sensor_msgs 12 | std_msgs 13 | nodelet 14 | ) 15 | 16 | #Get architecture 17 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") 18 | include(TargetArchitecture) 19 | target_architecture(ARCH) 20 | 21 | #add dynamic reconfigure api 22 | generate_dynamic_reconfigure_options( 23 | cfg/AvtVimbaCamera.cfg 24 | ) 25 | 26 | catkin_package( 27 | INCLUDE_DIRS include 28 | CATKIN_DEPENDS camera_info_manager diagnostic_updater dynamic_reconfigure image_transport roscpp sensor_msgs std_msgs 29 | ) 30 | 31 | ########### 32 | ## Build ## 33 | ########### 34 | 35 | include_directories( 36 | ${catkin_INCLUDE_DIRS} 37 | include 38 | ) 39 | 40 | # C++11 support 41 | include(CheckCXXCompilerFlag) 42 | CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX11) 43 | CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) 44 | if(COMPILER_SUPPORTS_CXX11) 45 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 46 | elseif(COMPILER_SUPPORTS_CXX0X) 47 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") 48 | else() 49 | message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") 50 | endif() 51 | 52 | function(add_dependencies_and_linkings arg) 53 | add_dependencies(${arg} 54 | ${PROJECT_NAME}_gencfg 55 | ) 56 | 57 | if("${ARCH}" STREQUAL x86_64) 58 | target_link_libraries(${arg} 59 | ${catkin_LIBRARIES} 60 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so 61 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so 62 | ) 63 | elseif("${ARCH}" STREQUAL armv7) 64 | target_link_libraries(${arg} 65 | ${catkin_LIBRARIES} 66 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so 67 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so 68 | ) 69 | elseif("${ARCH}" STREQUAL armv8) 70 | target_link_libraries(${arg} 71 | ${catkin_LIBRARIES} 72 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so 73 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so 74 | ) 75 | else() 76 | message(FATAL_ERROR "[libvimba]: Architecture ${ARCH} not suported. Exiting...") 77 | endif() 78 | endfunction(add_dependencies_and_linkings) 79 | 80 | # Nodes 81 | add_executable(mono_camera_node 82 | src/nodes/mono_camera_node.cpp 83 | src/mono_camera.cpp 84 | src/avt_vimba_camera.cpp 85 | src/frame_observer.cpp 86 | ) 87 | add_dependencies_and_linkings(mono_camera_node) 88 | 89 | add_executable(trigger_node 90 | src/nodes/trigger_node.cpp 91 | src/trigger.cpp 92 | ) 93 | add_dependencies_and_linkings(trigger_node) 94 | 95 | # Nodelets 96 | add_library(avt_camera_nodelets 97 | src/nodes/mono_camera_nodelet.cpp 98 | src/mono_camera.cpp 99 | src/avt_vimba_camera.cpp 100 | src/frame_observer.cpp 101 | ) 102 | add_dependencies_and_linkings(avt_camera_nodelets) 103 | 104 | ############# 105 | ## Install ## 106 | ############# 107 | 108 | ## Mark executables and/or libraries for installation 109 | install(TARGETS 110 | mono_camera_node 111 | trigger_node 112 | avt_camera_nodelets 113 | ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 114 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 115 | RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 116 | ) 117 | 118 | ## Mark cpp header files for installation 119 | install(DIRECTORY include 120 | DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} 121 | FILES_MATCHING PATTERN "*.h" 122 | ) 123 | 124 | ## Mark other files for installation (e.g. launch and bag files, etc.) 125 | install(FILES 126 | README.md 127 | plugins.xml 128 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 129 | ) 130 | 131 | install(DIRECTORY 132 | launch 133 | calibrations 134 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 135 | ) 136 | 137 | if("${ARCH}" STREQUAL x86_64) 138 | install(FILES 139 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaC.so 140 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/64bit/libVimbaCPP.so 141 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 142 | ) 143 | elseif("${ARCH}" STREQUAL armv7) 144 | install(FILES 145 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaC.so 146 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_32bit/libVimbaCPP.so 147 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 148 | ) 149 | elseif("${ARCH}" STREQUAL armv8) 150 | install(FILES 151 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaC.so 152 | ${CMAKE_CURRENT_SOURCE_DIR}/lib/arm_64bit/libVimbaCPP.so 153 | DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} 154 | ) 155 | endif() 156 | -------------------------------------------------------------------------------- /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 | 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_INTERFACE_HPP 29 | #define AVT_VMBAPI_INTERFACE_HPP 30 | 31 | // 32 | // Inline wrapper functions that allocate memory for STL objects in the application's context 33 | // and to pass data across DLL boundaries using arrays 34 | // 35 | 36 | // HINT: This information remains static throughout the object's lifetime 37 | inline VmbErrorType Interface::GetID( std::string &rStrID ) const 38 | { 39 | VmbErrorType res; 40 | VmbUint32_t nLength; 41 | 42 | res = GetID( NULL, nLength ); 43 | if ( VmbErrorSuccess == res) 44 | { 45 | if( 0 != nLength) 46 | { 47 | try 48 | { 49 | std::vector tmpID( nLength + 1, '\0' ); 50 | res = GetID( &tmpID[0], nLength ); 51 | if( VmbErrorSuccess == res ) 52 | { 53 | rStrID = &*tmpID.begin(); 54 | } 55 | } 56 | catch(...) 57 | { 58 | return VmbErrorResources; 59 | } 60 | } 61 | else 62 | { 63 | rStrID.clear(); 64 | } 65 | } 66 | 67 | return res; 68 | } 69 | 70 | // HINT: This information remains static throughout the object's lifetime 71 | inline VmbErrorType Interface::GetName( std::string &rStrName ) const 72 | { 73 | VmbErrorType res; 74 | VmbUint32_t nLength; 75 | 76 | res = GetName( NULL, nLength ); 77 | if ( VmbErrorSuccess == res ) 78 | { 79 | if( 0 != nLength ) 80 | { 81 | try 82 | { 83 | std::vector tmpName( nLength + 1, '\0' ); 84 | res = GetName( &tmpName[0], nLength ); 85 | if( VmbErrorSuccess == res ) 86 | { 87 | rStrName = &*tmpName.begin(); 88 | } 89 | } 90 | catch(...) 91 | { 92 | return VmbErrorResources; 93 | } 94 | } 95 | else 96 | { 97 | rStrName.clear(); 98 | } 99 | } 100 | 101 | return res; 102 | } 103 | 104 | // HINT: This information remains static throughout the object's lifetime 105 | inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const 106 | { 107 | VmbErrorType res; 108 | VmbUint32_t nLength; 109 | 110 | res = GetSerialNumber( NULL, nLength ); 111 | if ( VmbErrorSuccess == res ) 112 | { 113 | if( 0 != nLength) 114 | { 115 | try 116 | { 117 | std::vector tmpSerial( nLength + 1, '\0'); 118 | res = GetSerialNumber( &tmpSerial[0], nLength ); 119 | if( VmbErrorSuccess == res ) 120 | { 121 | rStrSerial = &*tmpSerial.begin(); 122 | } 123 | } 124 | catch(...) 125 | { 126 | return VmbErrorResources; 127 | } 128 | } 129 | else 130 | { 131 | rStrSerial.clear(); 132 | } 133 | } 134 | 135 | return res; 136 | } 137 | 138 | #endif 139 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/UserSharedPointerDefines.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: UserSharedPointerDefines.h 10 | 11 | Description: Definition of macros for using different shared pointer 12 | implementations. 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_USERSHAREDPOINTERDEFINES_H 30 | #define AVT_VMBAPI_USERSHAREDPOINTERDEFINES_H 31 | 32 | // 33 | // Vimba C++ API does not necessarily rely on AVT::VmbAPI::shared_ptr. You might want to use your own shared pointer type or the one that ships with your 34 | // implementation of the C++ standard. 35 | // To use a custom shared pointer implementation simply add the define USER_SHARED_POINTER to your project / compiler settings and complete this header file. 36 | // 37 | 38 | 39 | // Add all your required shared pointer implementation headers here. 40 | // HINT: #include is used for std::shared_ptr 41 | 42 | 43 | namespace AVT { 44 | namespace VmbAPI { 45 | 46 | // Set the calls for your implementation of the shared pointer functions 47 | // a) Declaration 48 | // b) Reset with argument 49 | // c) Reset without argument 50 | // d) == operator 51 | // e) NULL test 52 | // f) Access to underlying raw pointer 53 | // g) Dynamic cast of shared pointer 54 | 55 | // a) This is the define for a declaration. 56 | #define SP_DECL( T ) std::shared_ptr 57 | // b) This is the define for setting an existing shared pointer. 58 | #define SP_SET( sp, rawPtr ) (sp).reset( rawPtr ) 59 | // c) This is the define for resetting without an argument to decrease the ref count. 60 | #define SP_RESET( sp ) (sp).reset() 61 | // d) This is the define for the equal operator. Shared pointers are usually considered equal when the raw pointers point to the same address. 62 | #define SP_ISEQUAL( sp1, sp2 ) ( (sp1) == (sp2) ) 63 | // e) This is the define for the NULL check. 64 | #define SP_ISNULL( sp ) ( NULL == (sp) ) 65 | // f) This is the define for the raw pointer access. This is usually accomplished through the dereferencing operator (->). 66 | #define SP_ACCESS( sp ) (sp).get() 67 | // g) This is the define for the dynamic cast of the pointer. 68 | #define SP_DYN_CAST( sp, T ) std::dynamic_pointer_cast(sp) 69 | 70 | // These are all uses of a SP_DECL shared_ptr declaration 71 | class Interface; 72 | typedef SP_DECL( Interface ) InterfacePtr; 73 | 74 | class Camera; 75 | typedef SP_DECL( Camera ) CameraPtr; 76 | 77 | class Feature; 78 | typedef SP_DECL( Feature ) FeaturePtr; 79 | 80 | class FeatureContainer; 81 | typedef SP_DECL( FeatureContainer ) FeatureContainerPtr; 82 | 83 | class IFeatureObserver; 84 | typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr; 85 | 86 | class Frame; 87 | typedef SP_DECL( Frame ) FramePtr; 88 | 89 | class FrameHandler; 90 | typedef SP_DECL( FrameHandler ) FrameHandlerPtr; 91 | 92 | class IFrameObserver; 93 | typedef SP_DECL( IFrameObserver ) IFrameObserverPtr; 94 | 95 | class AncillaryData; 96 | typedef SP_DECL( AncillaryData ) AncillaryDataPtr; 97 | 98 | class ConstAncillaryData; 99 | typedef SP_DECL( const AncillaryData ) ConstAncillaryDataPtr; 100 | 101 | class ICameraFactory; 102 | typedef SP_DECL( ICameraFactory ) ICameraFactoryPtr; 103 | 104 | class ICameraListObserver; 105 | typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr; 106 | 107 | class IInterfaceListObserver; 108 | typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr; 109 | 110 | class Mutex; 111 | typedef SP_DECL( Mutex ) MutexPtr; 112 | 113 | class BasicLockable; 114 | typedef SP_DECL( BasicLockable ) BasicLockablePtr; 115 | 116 | }} // Namespace AVT::VmbAPI 117 | 118 | 119 | #endif //AVT_VMBAPI_USERSHAREDPOINTERDEFINES_H 120 | -------------------------------------------------------------------------------- /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/avt_vimba_camera/avt_vimba_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 AVT_VIMBA_CAMERA_H 34 | #define AVT_VIMBA_CAMERA_H 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | 48 | using AVT::VmbAPI::CameraPtr; 49 | using AVT::VmbAPI::FramePtr; 50 | using AVT::VmbAPI::IFrameObserverPtr; 51 | using AVT::VmbAPI::VimbaSystem; 52 | 53 | namespace avt_vimba_camera 54 | { 55 | enum CameraState 56 | { 57 | OPENING, 58 | IDLE, 59 | CAMERA_NOT_FOUND, 60 | FORMAT_ERROR, 61 | ERROR, 62 | OK 63 | }; 64 | 65 | class AvtVimbaCamera 66 | { 67 | public: 68 | typedef avt_vimba_camera::AvtVimbaCameraConfig Config; 69 | typedef std::function frameCallbackFunc; 70 | 71 | AvtVimbaCamera(); 72 | AvtVimbaCamera(const std::string& name); 73 | 74 | void start(const std::string& ip_str, const std::string& guid_str, const std::string& frame_id, 75 | bool print_all_features = false); 76 | void stop(); 77 | 78 | void updateConfig(Config& config); 79 | void startImaging(); 80 | void stopImaging(); 81 | 82 | // Utility functions 83 | double getTimestampRealTime(VmbUint64_t timestamp_ticks); 84 | bool isOpened() 85 | { 86 | return opened_; 87 | } 88 | 89 | // Getters 90 | double getTimestamp(); 91 | double getDeviceTemp(); 92 | int getSensorWidth(); 93 | int getSensorHeight(); 94 | 95 | // Setters 96 | void setCallback(frameCallbackFunc callback) 97 | { 98 | userFrameCallback = callback; 99 | } 100 | 101 | private: 102 | Config config_; 103 | 104 | AvtVimbaApi api_; 105 | // IFrame Observer 106 | SP_DECL(FrameObserver) frame_obs_ptr_; 107 | // The currently streaming camera 108 | CameraPtr vimba_camera_ptr_; 109 | // Current frame 110 | FramePtr vimba_frame_ptr_; 111 | // Tick frequency of the on-board clock. Equal to 1 GHz when PTP is in use. 112 | VmbInt64_t vimba_timestamp_tick_freq_ = 1; 113 | 114 | // Mutex 115 | std::mutex config_mutex_; 116 | 117 | CameraState camera_state_; 118 | bool opened_; 119 | bool streaming_; 120 | bool on_init_; 121 | std::string name_; 122 | std::string guid_; 123 | std::string frame_id_; 124 | 125 | diagnostic_updater::Updater updater_; 126 | std::string diagnostic_msg_; 127 | 128 | CameraPtr openCamera(const std::string& id_str, bool print_all_features); 129 | 130 | frameCallbackFunc userFrameCallback; 131 | void frameCallback(const FramePtr vimba_frame_ptr); 132 | 133 | template 134 | VmbErrorType setFeatureValue(const std::string& feature_str, const T& val); 135 | template 136 | bool getFeatureValue(const std::string& feature_str, T& val); 137 | bool getFeatureValue(const std::string& feature_str, std::string& val); 138 | template 139 | void configureFeature(const std::string& feature_str, const Vimba_Type& val_in, Std_Type& val_out); 140 | void configureFeature(const std::string& feature_str, const std::string& val_in, std::string& val_out); 141 | bool runCommand(const std::string& command_str); 142 | void printAllCameraFeatures(const CameraPtr& camera); 143 | 144 | void updateAcquisitionConfig(Config& config); 145 | void updateExposureConfig(Config& config); 146 | void updateGammaConfig(Config& config); 147 | void updateDspsubregionConfig(Config& config); 148 | void updateGainConfig(Config& config); 149 | void updateWhiteBalanceConfig(Config& config); 150 | void updateImageModeConfig(Config& config); 151 | void updateROIConfig(Config& config); 152 | void updateBandwidthConfig(Config& config); 153 | void updatePixelFormatConfig(Config& config); 154 | void updatePtpModeConfig(Config& config); 155 | void updateGPIOConfig(Config& config); 156 | void updateUSBGPIOConfig(Config& config); 157 | void updateIrisConfig(Config& config); 158 | 159 | void getCurrentState(diagnostic_updater::DiagnosticStatusWrapper& stat); 160 | }; 161 | } // namespace avt_vimba_camera 162 | #endif 163 | -------------------------------------------------------------------------------- /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/Include/Interface.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: Interface.h 10 | 11 | Description: Definition of class AVT::VmbAPI::Interface. 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_INTERFACE_H 29 | #define AVT_VMBAPI_INTERFACE_H 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | namespace AVT { 37 | namespace VmbAPI { 38 | 39 | class Interface : public FeatureContainer 40 | { 41 | public: 42 | 43 | Interface( const VmbInterfaceInfo_t *pInterfaceInfo ); 44 | 45 | virtual ~Interface(); 46 | 47 | // 48 | // Method: Open() 49 | // 50 | // Purpose: Open an interface handle for feature access. 51 | // 52 | // Parameters: none 53 | // 54 | // Returns: 55 | // - VmbErrorSuccess: If no error 56 | // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command 57 | // - VmbErrorNotFound: The designated interface cannot be found 58 | // 59 | // Details: An interface can be opened if interface-specific control is required, such as I/O pins 60 | // on a frame grabber card. Control is then possible via feature access methods. 61 | // 62 | IMEXPORT virtual VmbErrorType Open(); 63 | 64 | // 65 | // Method: Close() 66 | // 67 | // Purpose: Close an interface. 68 | // 69 | // Parameters: none 70 | // 71 | // Returns: 72 | // - VmbErrorSuccess: If no error 73 | // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command 74 | // - VmbErrorBadHandle: The handle is not valid 75 | // 76 | IMEXPORT virtual VmbErrorType Close(); 77 | 78 | // 79 | // Method: GetID() 80 | // 81 | // Purpose: Gets the ID of an interface. 82 | // 83 | // Parameters: [out] std::string& interfaceID The ID of the interface 84 | // 85 | // Returns: 86 | // - VmbErrorSuccess: If no error 87 | // 88 | // Details: This information remains static throughout the object's lifetime 89 | // 90 | VmbErrorType GetID( std::string &interfaceID ) const; 91 | 92 | // 93 | // Method: GetType() 94 | // 95 | // Purpose: Gets the type, e.g. FireWire, GigE or USB of an interface. 96 | // 97 | // Parameters: [out] VmbInterfaceType& type The type of the interface 98 | // 99 | // Returns: 100 | // - VmbErrorSuccess: If no error 101 | // 102 | // Details: This information remains static throughout the object's lifetime 103 | // 104 | IMEXPORT VmbErrorType GetType( VmbInterfaceType &type ) const; 105 | 106 | // 107 | // Method: GetName() 108 | // 109 | // Purpose: Gets the name of an interface. 110 | // 111 | // Parameters: [out] std::string& name The name of the interface 112 | // 113 | // Returns: 114 | // - VmbErrorSuccess: If no error 115 | // 116 | // This information remains static throughout the object's lifetime 117 | // 118 | VmbErrorType GetName( std::string &name ) const; 119 | 120 | // 121 | // Method: GetSerialNumber() 122 | // 123 | // Purpose: Gets the serial number of an interface. 124 | // 125 | // Parameters: [out] std::string& serialNumber The serial number of the interface 126 | // 127 | // Returns: 128 | // - VmbErrorSuccess: If no error 129 | // 130 | // This information remains static throughout the object's lifetime 131 | // 132 | VmbErrorType GetSerialNumber( std::string &serialNumber ) const; 133 | 134 | // 135 | // Method: GetPermittedAccess() 136 | // 137 | // Purpose: Gets the access mode of an interface. 138 | // 139 | // Parameters: [out] VmbAccessModeType& accessMode The possible access mode of the interface 140 | // 141 | // Returns: 142 | // - VmbErrorSuccess: If no error 143 | // 144 | IMEXPORT VmbErrorType GetPermittedAccess( VmbAccessModeType &accessMode ) const; 145 | 146 | private: 147 | // Default ctor 148 | Interface(); 149 | // Copy ctor 150 | Interface( const Interface& ); 151 | // Assignment operator 152 | Interface& operator=( const Interface& ); 153 | 154 | struct Impl; 155 | Impl *m_pImpl; 156 | 157 | // Array functions to pass data across DLL boundaries 158 | IMEXPORT VmbErrorType GetID( char * const pID, VmbUint32_t &length ) const; 159 | IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const; 160 | IMEXPORT VmbErrorType GetSerialNumber( char * const pSerial, VmbUint32_t &length ) const; 161 | }; 162 | 163 | #include 164 | 165 | }} // namespace AVT::VmbAPI 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /include/VimbaCPP/Include/EnumEntry.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: EnumEntry.hpp 10 | 11 | Description: Inline wrapper functions for class AVT::VmbAPI::EnumEntry. 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_ENUMENTRY_HPP 29 | #define AVT_VMBAPI_ENUMENTRY_HPP 30 | 31 | // 32 | // Inline wrapper functions that allocate memory for STL objects in the application's context 33 | // and to pass data across DLL boundaries using arrays 34 | // 35 | inline VmbErrorType EnumEntry::GetName( std::string &rStrName ) const 36 | { 37 | VmbErrorType res; 38 | VmbUint32_t nLength; 39 | 40 | res = GetName( NULL, nLength ); 41 | if ( VmbErrorSuccess == res ) 42 | { 43 | if ( 0 != nLength ) 44 | { 45 | try 46 | { 47 | std::vector tmpName( nLength + 1, '\0' ); 48 | res = GetName( &tmpName[0], nLength ); 49 | if ( VmbErrorSuccess == res ) 50 | { 51 | rStrName = &*tmpName.begin(); 52 | } 53 | } 54 | catch(...) 55 | { 56 | return VmbErrorResources; 57 | } 58 | } 59 | else 60 | { 61 | rStrName.clear(); 62 | } 63 | } 64 | 65 | return res; 66 | } 67 | 68 | inline VmbErrorType EnumEntry::GetDisplayName( std::string &rStrDisplayName ) const 69 | { 70 | VmbErrorType res; 71 | VmbUint32_t nLength; 72 | 73 | res = GetDisplayName( NULL, nLength ); 74 | if ( VmbErrorSuccess == res ) 75 | { 76 | if ( 0 != nLength ) 77 | { 78 | try 79 | { 80 | std::vector tmpName( nLength + 1, '\0' ); 81 | res = GetDisplayName( &tmpName[0], nLength ); 82 | if ( VmbErrorSuccess == res ) 83 | { 84 | rStrDisplayName = &*tmpName.begin(); 85 | } 86 | } 87 | catch(...) 88 | { 89 | return VmbErrorResources; 90 | } 91 | } 92 | else 93 | { 94 | rStrDisplayName.clear(); 95 | } 96 | } 97 | 98 | return res; 99 | } 100 | 101 | inline VmbErrorType EnumEntry::GetDescription( std::string &rStrDescription ) const 102 | { 103 | VmbErrorType res; 104 | VmbUint32_t nLength; 105 | 106 | res = GetDescription( NULL, nLength ); 107 | if ( VmbErrorSuccess == res ) 108 | { 109 | if ( 0 != nLength ) 110 | { 111 | try 112 | { 113 | std::vector tmpDescription( nLength + 1, '\0' ); 114 | res = GetDescription( &tmpDescription[0], nLength ); 115 | if ( VmbErrorSuccess == res ) 116 | { 117 | rStrDescription = &*tmpDescription.begin(); 118 | } 119 | } 120 | catch(...) 121 | { 122 | return VmbErrorResources; 123 | } 124 | } 125 | else 126 | { 127 | rStrDescription.clear(); 128 | } 129 | } 130 | 131 | return res; 132 | } 133 | 134 | inline VmbErrorType EnumEntry::GetTooltip( std::string &rStrTooltip ) const 135 | { 136 | VmbErrorType res; 137 | VmbUint32_t nLength; 138 | 139 | res = GetTooltip( NULL, nLength ); 140 | if ( VmbErrorSuccess == res ) 141 | { 142 | if ( 0 != nLength ) 143 | { 144 | try 145 | { 146 | std::vector tmpTooltip( nLength + 1, '\0' ); 147 | res = GetTooltip( &tmpTooltip[0], nLength ); 148 | if ( VmbErrorSuccess == res ) 149 | { 150 | rStrTooltip = &*tmpTooltip.begin(); 151 | } 152 | } 153 | catch(...) 154 | { 155 | return VmbErrorResources; 156 | } 157 | } 158 | else 159 | { 160 | rStrTooltip.clear(); 161 | } 162 | } 163 | 164 | return res; 165 | } 166 | 167 | inline VmbErrorType EnumEntry::GetSFNCNamespace( std::string &rStrNamespace ) const 168 | { 169 | VmbErrorType res; 170 | VmbUint32_t nLength; 171 | 172 | res = GetSFNCNamespace( NULL, nLength ); 173 | if ( VmbErrorSuccess == res ) 174 | { 175 | if ( 0 != nLength ) 176 | { 177 | try 178 | { 179 | std::vector tmpNamespace( nLength + 1, '\0' ); 180 | res = GetSFNCNamespace( &tmpNamespace[0], nLength ); 181 | if ( VmbErrorSuccess == res ) 182 | { 183 | rStrNamespace =&*tmpNamespace.begin(); 184 | } 185 | } 186 | catch(...) 187 | { 188 | return VmbErrorResources; 189 | } 190 | } 191 | else 192 | { 193 | rStrNamespace.clear(); 194 | } 195 | } 196 | 197 | return res; 198 | } 199 | 200 | #endif 201 | --------------------------------------------------------------------------------