VimbaSystem.h
Go to the documentation of this file.
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.h
10 
11  Description: Definition of 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_SYSTEM_H
29 #define AVT_VMBAPI_SYSTEM_H
30 
31 #include <vector>
32 
33 #include <VimbaC/Include/VimbaC.h>
42 
43 namespace AVT {
44 namespace VmbAPI {
45 
46 typedef std::vector<InterfacePtr> InterfacePtrVector;
47 
49 {
50  public:
51  //
52  // Method: GetInstance()
53  //
54  // Purpose: Returns a reference to the System singleton.
55  //
56  // Parameters: none
57  //
58  // Returns:
59  //
60  // - VimbaSystem&
61  //
62  IMEXPORT static VimbaSystem& GetInstance();
63 
64  //
65  // Method: QueryVersion()
66  //
67  // Purpose: Retrieve the version number of VmbAPI.
68  //
69  // Parameters:
70  //
71  // [out] VmbVersionInfo_t& version Reference to the struct where version information
72  // is copied
73  //
74  // Returns:
75  //
76  // - VmbErrorSuccess: always returned
77  //
78  // Details: This function can be called at any time, even before the API is
79  // initialized. All other version numbers may be queried via feature access
80  //
81  IMEXPORT VmbErrorType QueryVersion( VmbVersionInfo_t &version );
82 
83  //
84  // Method: Startup()
85  //
86  // Purpose: Initialize the VmbAPI module.
87  //
88  // Parameters: none
89  //
90  // Returns:
91  //
92  // - VmbErrorSuccess: If no error
93  // - VmbErrorInternalFault: An internal fault occurred
94  //
95  // Details: On successful return, the API is initialized; this is a necessary call.
96  // This method must be called before any other VmbAPI function is run.
97  //
98  IMEXPORT VmbErrorType Startup();
99 
100  //
101  // Method: Shutdown()
102  //
103  // Purpose: Perform a shutdown on the API module.
104  //
105  // Parameters: none
106  //
107  // Returns:
108  //
109  // - VmbErrorSuccess: always returned
110  //
111  // Details: This will free some resources and deallocate all physical resources if applicable.
112  //
113  IMEXPORT VmbErrorType Shutdown();
114 
115  //
116  // Method: GetInterfaces()
117  //
118  // Purpose: List all the interfaces currently visible to VmbAPI.
119  //
120  // Parameters:
121  //
122  // [out] InterfacePtrVector& interfaces Vector of shared pointer to Interface object
123  //
124  // Returns:
125  //
126  // - VmbErrorSuccess: If no error
127  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
128  // - VmbErrorStructSize: The given struct size is not valid for this API version
129  // - VmbErrorMoreData: More data were returned than space was provided
130  // - VmbErrorInternalFault: An internal fault occurred
131  //
132  // Details: All the interfaces known via a GenTL are listed by this command and filled into the vector provided.
133  // If the vector is not empty, new elements will be appended.
134  // Interfaces can be adapter cards or frame grabber cards, for instance.
135  //
136  VmbErrorType GetInterfaces( InterfacePtrVector &interfaces );
137 
138  //
139  // Method: GetInterfaceByID()
140  //
141  // Purpose: Gets a specific interface identified by an ID.
142  //
143  // Parameters:
144  //
145  // [in ] const char* pID The ID of the interface to get (returned by GetInterfaces())
146  // [out] InterfacePtr& pInterface Shared pointer to Interface object
147  //
148  // Returns:
149  //
150  // - VmbErrorSuccess: If no error
151  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
152  // - VmbErrorBadParameter: "pID" is NULL.
153  // - VmbErrorStructSize: The given struct size is not valid for this API version
154  // - VmbErrorMoreData: More data were returned than space was provided
155  //
156  // Details: An interface known via a GenTL is listed by this command and filled into the pointer provided.
157  // Interface can be an adapter card or a frame grabber card, for instance.
158  //
159  IMEXPORT VmbErrorType GetInterfaceByID( const char *pID, InterfacePtr &pInterface );
160 
161  //
162  // Method: OpenInterfaceByID()
163  //
164  // Purpose: Open an interface for feature access.
165  //
166  // Parameters:
167  //
168  // [in ] const char* pID The ID of the interface to open (returned by GetInterfaces())
169  // [out] InterfacePtr& pInterface A shared pointer to the interface
170  //
171  // Returns:
172  //
173  // - VmbErrorSuccess: If no error
174  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
175  // - VmbErrorNotFound: The designated interface cannot be found
176  // - VmbErrorBadParameter: "pID" is NULL.
177  //
178  //
179  // Details: An interface can be opened if interface-specific control is required, such as I/O pins
180  // on a frame grabber card. Control is then possible via feature access methods.
181  //
182  IMEXPORT VmbErrorType OpenInterfaceByID( const char *pID, InterfacePtr &pInterface );
183 
184  //
185  // Method: GetCameras()
186  //
187  // Purpose: Retrieve a list of all cameras.
188  //
189  // Parameters:
190  //
191  // [out] CameraPtrVector& cameras Vector of shared pointer to Camera object
192  //
193  // Returns:
194  //
195  // - VmbErrorSuccess: If no error
196  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
197  // - VmbErrorStructSize: The given struct size is not valid for this API version
198  // - VmbErrorMoreData: More data were returned than space was provided
199  //
200  // Details: A camera known via a GenTL is listed by this command and filled into the pointer provided.
201  //
203 
204  //
205  // Method: GetCameraByID()
206  //
207  // Purpose: Gets a specific camera identified by an ID. The returned camera is still closed.
208  //
209  // Parameters:
210  //
211  // [in ] const char* pID The ID of the camera to get
212  // [out] CameraPtr& pCamera Shared pointer to camera object
213  //
214  // Returns:
215  //
216  // - VmbErrorSuccess: If no error
217  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
218  // - VmbErrorBadParameter: "pID" is NULL.
219  // - VmbErrorStructSize: The given struct size is not valid for this API version
220  // - VmbErrorMoreData: More data were returned than space was provided
221  //
222  // Details: A camera known via a GenTL is listed by this command and filled into the pointer provided.
223  // Only static properties of the camera can be fetched until the camera has been opened.
224  // "pID" might be one of the following:
225  // "169.254.12.13" for an IP address,
226  // "000F314C4BE5" for a MAC address or
227  // "DEV_1234567890" for an ID as reported by Vimba
228  //
229  IMEXPORT VmbErrorType GetCameraByID( const char *pID, CameraPtr &pCamera );
230 
231  //
232  // Method: OpenCameraByID()
233  //
234  // Purpose: Gets a specific camera identified by an ID. The returned camera is already open.
235  //
236  // Parameters:
237  //
238  // [in ] const char* pID The unique ID of the camera to get
239  // [in ] VmbAccessModeType eAccessMode The requested access mode
240  // [out] CameraPtr& pCamera A shared pointer to the camera
241  //
242  // Returns:
243  //
244  // - VmbErrorSuccess: If no error
245  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
246  // - VmbErrorNotFound: The designated interface cannot be found
247  // - VmbErrorBadParameter: "pID" is NULL.
248  //
249  // Details: A camera can be opened if camera-specific control is required, such as I/O pins
250  // on a frame grabber card. Control is then possible via feature access methods.
251  // "pID" might be one of the following:
252  // "169.254.12.13" for an IP address,
253  // "000F314C4BE5" for a MAC address or
254  // "DEV_1234567890" for an ID as reported by Vimba
255  //
256  IMEXPORT VmbErrorType OpenCameraByID( const char *pID, VmbAccessModeType eAccessMode, CameraPtr &pCamera );
257 
258  //
259  // Method: RegisterCameraListObserver()
260  //
261  // Purpose: Registers an instance of camera observer whose CameraListChanged() method gets called
262  // as soon as a camera is plugged in, plugged out, or changes its access status
263  //
264  // Parameters:
265  //
266  // [in ] const ICameraListObserverPtr& pObserver A shared pointer to an object derived from ICameraListObserver
267  //
268  // Returns:
269  //
270  // - VmbErrorSuccess: If no error
271  // - VmbErrorBadParameter: "pObserver" is NULL.
272  // - VmbErrorInvalidCall: If the very same observer is already registered
273  //
274  IMEXPORT VmbErrorType RegisterCameraListObserver( const ICameraListObserverPtr &pObserver );
275 
276  //
277  // Method: UnregisterCameraListObserver()
278  //
279  // Purpose: Unregisters a camera observer
280  //
281  // Parameters:
282  //
283  // [in ] const ICameraListObserverPtr& pObserver A shared pointer to an object derived from ICameraListObserver
284  //
285  // Returns:
286  //
287  // - VmbErrorSuccess: If no error
288  // - VmbErrorNotFound: If the observer is not registered
289  // - VmbErrorBadParameter: "pObserver" is NULL.
290  //
291  IMEXPORT VmbErrorType UnregisterCameraListObserver( const ICameraListObserverPtr &pObserver );
292 
293  //
294  // Method: RegisterInterfaceListObserver()
295  //
296  // Purpose: Registers an instance of interface observer whose InterfaceListChanged() method gets called
297  // as soon as an interface is plugged in, plugged out, or changes its access status
298  //
299  // Parameters:
300  //
301  // [in ] const IInterfaceListObserverPtr& pObserver A shared pointer to an object derived from IInterfaceListObserver
302  //
303  // Returns:
304  //
305  // - VmbErrorSuccess: If no error
306  // - VmbErrorBadParameter: "pObserver" is NULL.
307  // - VmbErrorInvalidCall: If the very same observer is already registered
308  //
309  IMEXPORT VmbErrorType RegisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
310 
311  //
312  // Method: UnregisterInterfaceListObserver()
313  //
314  // Purpose: Unregisters an interface observer
315  //
316  // Parameters:
317  //
318  // [in ] const IInterfaceListObserverPtr& pObserver A shared pointer to an object derived from IInterfaceListObserver
319  //
320  // Returns:
321  //
322  // - VmbErrorSuccess: If no error
323  // - VmbErrorNotFound: If the observer is not registered
324  // - VmbErrorBadParameter: "pObserver" is NULL.
325  //
326  IMEXPORT VmbErrorType UnregisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
327 
328  //
329  // Method: RegisterCameraFactory()
330  //
331  // Purpose: Registers an instance of camera factory. When a custom camera factory is registered, all instances of type camera
332  // will be set up accordingly.
333  //
334  // Parameters:
335  //
336  // [in ] const ICameraFactoryPtr& pCameraFactory A shared pointer to an object derived from ICameraFactory
337  //
338  // Returns:
339  //
340  // - VmbErrorSuccess: If no error
341  // - VmbErrorBadParameter: "pCameraFactory" is NULL.
342  //
343  IMEXPORT VmbErrorType RegisterCameraFactory( const ICameraFactoryPtr &pCameraFactory );
344 
345  //
346  // Method: UnregisterCameraFactory()
347  //
348  // Purpose: Unregisters the camera factory. After unregistering the default camera class is used.
349  //
350  // Returns:
351  //
352  // - VmbErrorSuccess: If no error
353  //
355 
356  // Mapping of handle to CameraPtr
357  CameraPtr GetCameraPtrByHandle( const VmbHandle_t handle ) const;
358 
359  Logger GetLogger() const;
360 
361  private:
362  // Singleton.
364  VimbaSystem();
365  VimbaSystem( const VimbaSystem& );
366  ~VimbaSystem();
367  VimbaSystem& operator=( const VimbaSystem& system );
368 
369  struct Impl;
370  Impl *m_pImpl;
371 
372  IMEXPORT VmbErrorType GetCameras( CameraPtr *pCameras, VmbUint32_t &size );
373  IMEXPORT VmbErrorType GetInterfaces( InterfacePtr *pInterfaces, VmbUint32_t &size );
374 };
375 
377 
378 }} // namespace AVT::VmbAPI
379 #endif
IMEXPORT VmbErrorType GetCameraByID(const char *pID, CameraPtr &pCamera)
static IMEXPORT VimbaSystem & GetInstance()
Definition: VimbaSystem.cpp:79
IMEXPORT VmbErrorType Startup()
Definition: VimbaSystem.cpp:93
std::vector< CameraPtr > CameraPtrVector
Definition: Camera.h:45
IMEXPORT VmbErrorType RegisterCameraListObserver(const ICameraListObserverPtr &pObserver)
VmbErrorType GetInterfaces(InterfacePtrVector &interfaces)
Logger GetLogger() const
CameraPtr GetCameraPtrByHandle(const VmbHandle_t handle) const
IMEXPORT VmbErrorType OpenCameraByID(const char *pID, VmbAccessModeType eAccessMode, CameraPtr &pCamera)
LOGGER_DECL * Logger
Definition: LoggerDefines.h:47
VmbErrorType
VmbAccessModeType
Definition: VimbaC.h:122
static VimbaSystem _instance
Definition: VimbaSystem.h:363
void * VmbHandle_t
VmbErrorType GetCameras(CameraPtrVector &cameras)
VimbaSystem & operator=(const VimbaSystem &system)
IMEXPORT VmbErrorType RegisterInterfaceListObserver(const IInterfaceListObserverPtr &pObserver)
IMEXPORT VmbErrorType RegisterCameraFactory(const ICameraFactoryPtr &pCameraFactory)
NetPointer< Camera, AVT::VmbAPINET::Camera > CameraPtr
IMEXPORT VmbErrorType UnregisterInterfaceListObserver(const IInterfaceListObserverPtr &pObserver)
IMEXPORT VmbErrorType QueryVersion(VmbVersionInfo_t &version)
Definition: VimbaSystem.cpp:84
NetPointer< Interface, AVT::VmbAPINET::Interface > InterfacePtr
unsigned int VmbUint32_t
IMEXPORT VmbErrorType UnregisterCameraFactory()
IMEXPORT VmbErrorType Shutdown()
IMEXPORT VmbErrorType UnregisterCameraListObserver(const ICameraListObserverPtr &pObserver)
std::vector< InterfacePtr > InterfacePtrVector
Definition: VimbaSystem.h:46
IMEXPORT VmbErrorType GetInterfaceByID(const char *pID, InterfacePtr &pInterface)
IMEXPORT VmbErrorType OpenInterfaceByID(const char *pID, InterfacePtr &pInterface)


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Wed Jun 5 2019 22:22:40