VimbaSystem.h
Go to the documentation of this file.
00001 /*=============================================================================
00002   Copyright (C) 2012 Allied Vision Technologies.  All Rights Reserved.
00003 
00004   Redistribution of this file, in original or modified form, without
00005   prior written consent of Allied Vision Technologies is prohibited.
00006 
00007 -------------------------------------------------------------------------------
00008  
00009   File:        VimbaSystem.h
00010 
00011   Description: Definition of class AVT::VmbAPI::VimbaSystem.
00012 
00013 -------------------------------------------------------------------------------
00014 
00015   THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
00016   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
00017   NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR  PURPOSE ARE
00018   DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
00019   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00020   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00021   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  
00022   AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
00023   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00024   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 
00026 =============================================================================*/
00027 
00028 #ifndef AVT_VMBAPI_SYSTEM_H
00029 #define AVT_VMBAPI_SYSTEM_H
00030 
00031 #include <vector>
00032 
00033 #include <VimbaC/Include/VimbaC.h>
00034 #include <VimbaCPP/Include/VimbaCPPCommon.h>
00035 #include <VimbaCPP/Include/LoggerDefines.h>
00036 #include <VimbaCPP/Include/SharedPointerDefines.h>
00037 #include <VimbaCPP/Include/Interface.h>
00038 #include <VimbaCPP/Include/Camera.h>
00039 #include <VimbaCPP/Include/ICameraFactory.h>
00040 #include <VimbaCPP/Include/ICameraListObserver.h>
00041 #include <VimbaCPP/Include/IInterfaceListObserver.h>
00042 
00043 namespace AVT {
00044 namespace VmbAPI {
00045 
00046 typedef std::vector<InterfacePtr> InterfacePtrVector;
00047 
00048 class VimbaSystem
00049 {
00050   public:
00051     //
00052     // Method:      GetInstance()
00053     //
00054     // Purpose:     Returns a reference to the singleton.
00055     //
00056     // Parameters:  none
00057     //
00058     // Returns:
00059     //  - VimbaSystem&
00060     //
00061     IMEXPORT static VimbaSystem& GetInstance();
00062 
00063     //
00064     // Method:    QueryVersion()
00065     //
00066     // Purpose:   Retrieve the version number of VmbAPI.
00067     //
00068     // Parameters:
00069     //  [out]  VmbVersionInfo_t&   version      Reference to the struct where version information
00070     //                                          is copied
00071     //
00072     // Returns:
00073     //  - VmbErrorSuccess:       If no error
00074     //  - VmbErrorStructSize:    The given struct size is not valid for this version of the API
00075     //  - VmbErrorBadParameter:  "pVersionInfo" is NULL.
00076     //
00077     // Details:    This function can be called at anytime, even before the API is
00078     //             initialized. All other version numbers may be queried via feature access
00079     //
00080     IMEXPORT VmbErrorType QueryVersion( VmbVersionInfo_t &version );
00081     
00082     //
00083     // Method:      Startup()
00084     //
00085     // Purpose:     Initialize the VmbApi module.
00086     //
00087     // Parameters:  none
00088     //
00089     // Returns:
00090     //  - VmbErrorSuccess:       If no error
00091     //  - VmbErrorInternalFault: An internal fault occurred
00092     //
00093     // Details:   On successful return, the API is initialized; this is a necessary call.
00094     //
00095     // Internal:
00096     //  - VimbaSystem initialization (open log files, ...)
00097     //  - Check system configuration (correct version of Transport Layer modules, ...)
00098     //  - This method must be called before any other VmbApi function is run.
00099     //
00100     IMEXPORT VmbErrorType Startup();
00101 
00102     //
00103     // Method:    Shutdown()
00104     //
00105     // Purpose:   Perform a shutdown on the API module.
00106     //
00107     // Parameters: none
00108     //
00109     // Returns:
00110     //  - VmbErrorSuccess:       If no error
00111     //  - VmbErrorInternalFault: An internal fault occurred
00112     //
00113     // Details:   This will free some resources and deallocate all physical resources if applicable.
00114     //
00115     IMEXPORT VmbErrorType Shutdown();
00116 
00117     //
00118     // Method:    GetInterfaces()
00119     //
00120     // Purpose:   List all the interfaces currently visible to VmbApi.
00121     //
00122     // Parameters:
00123     //  [out]  InterfacePtrVector& Interfaces            Vector of shared pointer to Interface object
00124     //
00125     // Returns:
00126     //  - VmbErrorSuccess:       If no error
00127     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00128     //  - VmbErrorStructSize:    The given struct size is not valid for this API version
00129     //  - VmbErrorMoreData:      More data was returned than space was provided
00130     //
00131     // Details:     All the interfaces known via a GenTL are listed by this command and filled into the vector provided.
00132     //              If the vector is not empty, new elements will be appended.
00133     //              Interfaces may be adapter cards or frame grabber cards, for instance.
00134     //
00135     VmbErrorType GetInterfaces( InterfacePtrVector &interfaces );
00136 
00137     //
00138     // Method:    GetInterfaceByID()
00139     //
00140     // Purpose:   Gets a specific interface identified by an ID.
00141     //
00142     // Parameters:
00143     //  [out]  InterfacePtr&        pInterface           Shared pointer to Interface object
00144     //
00145     // Returns:
00146     //  - VmbErrorSuccess:          If no error
00147     //  - VmbErrorApiNotStarted:    VmbStartup() was not called before the current command
00148     //  - VmbErrorStructSize:       The given struct size is not valid for this API version
00149     //  - VmbErrorMoreData:         More data was returned than space was provided
00150     //
00151     // Details:     An interface known via a GenTL is listed by this command and filled into the pointer provided.
00152     //              Interface may be adapter card or frame grabber card, for instance.
00153     //
00154     IMEXPORT VmbErrorType GetInterfaceByID( const char *pID, InterfacePtr &pInterface );
00155 
00156     //
00157     // Method:      OpenInterfaceByID()
00158     //
00159     // Purpose:     Open an interface for feature access.
00160     //
00161     // Parameters:
00162     //
00163     //  [in ]  const char*      pID                 The unique ID of the interface to get
00164     //  [out]  InterfacePtr&    pInterface          A shared pointer to the interface
00165     //
00166     // Returns:
00167     //
00168     //  - VmbErrorSuccess:       If no error
00169     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00170     //  - VmbErrorNotFound:      The designated interface cannot be found
00171     //
00172     // Details:     An interface can be opened if interface-specific control is required, such as I/O pins
00173     //              on a frame grabber card. Control is then possible via feature access methods.
00174     //
00175     IMEXPORT VmbErrorType OpenInterfaceByID( const char *pID, InterfacePtr &pInterface );
00176 
00177     //
00178     // Method:    GetCameras()
00179     //
00180     // Purpose:   Retrieve a list of all cameras.
00181     //
00182     // Parameters:
00183     //  [out]  CameraPtrVector& rCameras            Vector of shared pointer to Camera object
00184     //
00185     // Returns:
00186     //  - VmbErrorSuccess:       If no error
00187     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00188     //  - VmbErrorStructSize:    The given struct size is not valid for this API version
00189     //  - VmbErrorMoreData:      More data was returned than space was provided
00190     //
00191     // Details:     A camera known via a GenTL is listed by this command and filled into the pointer provided.
00192     //
00193     VmbErrorType GetCameras( CameraPtrVector &cameras );
00194 
00195     //
00196     // Method:    GetCameraByID()
00197     //
00198     // Purpose:   Gets a specific camera identified by an ID. The returned camera is still closed.
00199     //
00200     // Parameters:
00201     //  [out]  CameraPtr&           pCamera              Shared pointer to camera object
00202     //
00203     // Returns:
00204     //  - VmbErrorSuccess:          If no error
00205     //  - VmbErrorApiNotStarted:    VmbStartup() was not called before the current command
00206     //  - VmbErrorStructSize:       The given struct size is not valid for this API version
00207     //  - VmbErrorMoreData:         More data was returned than space was provided
00208     //
00209     // Details:     A camera known via a GenTL is listed by this command and filled into the pointer provided.
00210     //              Only static properties of the camera can be fetched until the camera has been opened.
00211         //                              A GigE camera can be identified with its IP address as well.
00212     //
00213     IMEXPORT VmbErrorType GetCameraByID( const char *pID, CameraPtr &pCamera );
00214     
00215     //
00216     // Method:      OpenCameraByID()
00217     //
00218     // Purpose:     Gets a specific camera identified by an ID. The returned camera is already open.
00219     //
00220     // Parameters:
00221     //
00222     //  [in ]   const char*         pID                 The unique ID of the camera to get
00223     //  [in ]   VmbAccessModeType   eAccessMode         The requested access mode
00224     //  [out]   CameraPtr&          pCamera             A shared pointer to the camera
00225     //
00226     // Returns:
00227     //
00228     //  - VmbErrorSuccess:       If no error
00229     //  - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
00230     //  - VmbErrorNotFound:      The designated interface cannot be found
00231     //
00232     // Details:     A camera can be opened if camera-specific control is required, such as I/O pins
00233     //              on a frame grabber card. Control is then possible via feature access methods.
00234         //                              A GigE camera can be identified with its IP address as well.
00235     //
00236     IMEXPORT VmbErrorType OpenCameraByID( const char *pID, VmbAccessModeType eAccessMode, CameraPtr &pCamera );
00237 
00238     //
00239     // Method:      RegisterCameraListObserver()
00240     //
00241     // Purpose:     Registers an instance of camera observer who's CameraListChanged() method gets called
00242     //              as soon as a camera is plugged in, plugged out or changes its access status
00243     //
00244     // Parameters:
00245     //
00246     //  [in ]       const ICameraListObserverPtr    &pObserver      A shared pointer to an object derived from ICameraListObserver
00247     //
00248     // Returns:
00249     //
00250     //  - VmbErrorSuccess:      If no error
00251     //  - VmbErrorInvalidCall:  If the very same observer is already registered
00252     //
00253     IMEXPORT VmbErrorType RegisterCameraListObserver( const ICameraListObserverPtr &pObserver );
00254 
00255     //
00256     // Method:      UnregisterCameraListObserver()
00257     //
00258     // Purpose:     Unregisters a camera observer
00259     //
00260     // Parameters:
00261     //
00262     //  [in ]       const ICameraListObserverPtr    &pObserver      A shared pointer to an object derived from ICameraListObserver
00263     //
00264     // Returns:
00265     //
00266     //  - VmbErrorSuccess:      If no error
00267     //  - VmbErrorNotFound:     If the observer is not registered
00268     //
00269     IMEXPORT VmbErrorType UnregisterCameraListObserver( const ICameraListObserverPtr &pObserver );
00270 
00271     //
00272     // Method:      RegisterInterfaceListObserver()
00273     //
00274     // Purpose:     Registers an instance of interface observer whose InterfaceListChanged() method gets called
00275     //              as soon as an interface is plugged in, plugged out, or changes its access status
00276     //
00277     // Parameters:
00278     //
00279     //  [in ]       const IInterfaceListObserverPtr    &pObserver      A shared pointer to an object derived from IInterfaceListObserver
00280     //
00281     // Returns:
00282     //
00283     //  - VmbErrorSuccess:      If no error
00284     //  - VmbErrorInvalidCall:  If the very same observer is already registered
00285     //
00286     IMEXPORT VmbErrorType RegisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
00287 
00288     //
00289     // Method:      UnregisterInterfaceListObserver()
00290     //
00291     // Purpose:     Unregisters an interface observer
00292     //
00293     // Parameters:
00294     //
00295     //  [in ]       const IInterfaceListObserverPtr    &pObserver      A shared pointer to an object derived from IInterfaceListObserver
00296     //
00297     // Returns:
00298     //
00299     //  - VmbErrorSuccess:      If no error
00300     //  - VmbErrorNotFound:     If the observer is not registered
00301     //
00302     IMEXPORT VmbErrorType UnregisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
00303 
00304     //
00305     // Method:      RegisterCameraFactory()
00306     //
00307     // Purpose:     Registers an instance of camera factory. When a custom camera factory is registered, all instances of type camera
00308     //              will be set up accordingly.
00309     //
00310     // Parameters:
00311     //
00312     //  [in ]       const ICameraFactoryPtr         &cameraFactory  A shared pointer to an object derived from ICameraFactory
00313     //
00314     // Returns:
00315     //
00316     //  - VmbErrorSuccess:      If no error
00317     //
00318     IMEXPORT VmbErrorType RegisterCameraFactory( const ICameraFactoryPtr &cameraFactory );
00319 
00320     //
00321     // Method:      UnregisterCameraFactory()
00322     //
00323     // Purpose:     Unregisters the camera factory. After unregistering the default camera class is used.
00324     //
00325     // Returns:
00326     //
00327     //  - VmbErrorSuccess:      If no error
00328     //
00329     IMEXPORT VmbErrorType UnregisterCameraFactory();
00330 
00331     // Mapping of handle to CameraPtr
00332     CameraPtr GetCameraPtrByHandle( const VmbHandle_t handle ) const;
00333 
00334     Logger GetLogger() const;
00335 
00336   private:
00337     // Singleton.
00338     static VimbaSystem _instance;
00339     VimbaSystem();
00340     VimbaSystem( const VimbaSystem& );
00341     ~VimbaSystem();
00342     VimbaSystem& operator=( const VimbaSystem& system );
00343     
00344     struct Impl;
00345     Impl *m_pImpl;    
00346 
00347     IMEXPORT VmbErrorType GetCameras( CameraPtr *pCameras, VmbUint32_t &size );
00348     IMEXPORT VmbErrorType GetInterfaces( InterfacePtr *pInterfaces, VmbUint32_t &size );
00349 };
00350 
00351 #include <VimbaCPP/Include/VimbaSystem.hpp>
00352 
00353 }} // namespace AVT::VmbAPI
00354 #endif


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Thu Aug 27 2015 12:29:49