Camera.cpp
Go to the documentation of this file.
1 /*=============================================================================
2  Copyright (C) 2012 - 2016 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: Camera.cpp
10 
11  Description: Implementation of class AVT::VmbAPI::Camera.
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 #pragma warning(disable:4996)
28 #include <sstream>
29 #pragma warning(default:4996)
30 #include <cstring>
31 
33 
38 #include <VimbaCPP/Source/Helper.h>
40 
41 namespace AVT {
42 namespace VmbAPI {
43 
44 // Method: GetFeatureValueInt
45 //
46 //Purpose: helper function to read integer value from camera.
47 //
48 // Parameters:
49 //
50 // [in] cam camera to get integer value from
51 // [in] name name of the feature
52 // [out] val returns integer value of feature on VmbErrorSuccess
53 //
54 VmbErrorType GetFeatureValueInt( Camera&cam,const char* name, VmbInt64_t &val)
55 {
56  if( NULL == name)
57  {
58  LOG_FREE_TEXT("feature name is NULL");
59  return VmbErrorBadParameter;
60  }
61  FeaturePtr pFeature;
62  VmbErrorType res = cam.GetFeatureByName( name, pFeature );
63  if ( VmbErrorSuccess != res )
64  {
65  LOG_FREE_TEXT( std::string("Could not get feature by name for ") + name);
66  return res;
67  }
68  res = SP_ACCESS(pFeature)->GetValue( val );
69  if( VmbErrorSuccess != res)
70  {
71  LOG_FREE_TEXT( std::string("Could not get value of feature ") + name);
72  }
73  return res;
74 }
75 //
76 // Method: RunFeatureCommand
77 //
78 // Purpose: helper to run a command feature for camera.
79 //
80 // Parameters:
81 //
82 // [in] cam camera to run command on
83 // [in] name command name to run
84 //
85 VmbErrorType RunFeatureCommand( Camera&cam,const char* name)
86 {
87  if( NULL == name)
88  {
89  LOG_FREE_TEXT("feature name is NULL");
90  return VmbErrorBadParameter;
91  }
92  FeaturePtr pFeature;
93  VmbErrorType res = cam.GetFeatureByName( name, pFeature );
94  if ( VmbErrorSuccess != res )
95  {
96  LOG_FREE_TEXT( std::string("Could not get feature by name for ") + name);
97  return res;
98  }
99  res = SP_ACCESS(pFeature)->RunCommand();
100  if( VmbErrorSuccess != res)
101  {
102  LOG_FREE_TEXT( std::string("Could not run feature command ") + name);
103  }
104  return res;
105 }
106 
107 // small helper class that keeps track of resources needed for image acquisition
109 {
110 private:
111  //clean up tasks
113  {
118  };
119  typedef std::vector<tear_down_tasks> task_storage;
120  task_storage m_Tasks; // storage for cleanup tasks
124  {
125  tear_down_tasks current_task = m_Tasks.back();
126  m_Tasks.pop_back();
127  return current_task;
128  }
130  // Method: SetupFrame
131  //
132  // Purpose: prepare a frame with given payload size.
133  //
134  // Parameters:
135  // [in,out] pFrame a frame pointer that can point to Null
136  // [in] payload_size payload size for frame
137  //
138  static VmbErrorType SetupFrame(FramePtr &pFrame, VmbInt64_t PayloadSize)
139  {
140  if( PayloadSize <= 0)
141  {
142  LOG_FREE_TEXT("payload size has to be larger than 0");
143  return VmbErrorBadParameter;
144  }
145  VmbUint32_t buffer_size(0);
146  VmbErrorType Result;
147  if( ! SP_ISNULL( pFrame) ) // if frame already exists, check its buffer size
148  {
149  Result = SP_ACCESS( pFrame) ->GetBufferSize(buffer_size);
150  if( VmbErrorSuccess != Result)
151  {
152  LOG_FREE_TEXT("Could not get frame buffer size");
153  return Result;
154  }
155  if( buffer_size >= PayloadSize) // buffer is large enough, no need to create new frame
156  {
157  return VmbErrorSuccess;
158  }
159  }
160  try
161  {
162  SP_SET( pFrame, new Frame( PayloadSize));
163  if( SP_ISNULL( pFrame) ) // in case we find a not throwing new
164  {
165  LOG_FREE_TEXT("error allocating frame");
166  return VmbErrorResources;
167  }
168  }
169  catch(...)
170  {
171  LOG_FREE_TEXT("error allocating frame");
172  return VmbErrorResources;
173  }
174  return VmbErrorSuccess;
175  }
176 public:
177  // construct helper from camera
179  : m_Camera( Cam)
180  {}
181  // destroy will tear all down
183  {
184  TearDown();
185  }
186  //
187  // Method:: AnnounceFrames
188  //
189  // Purpose: helper to announce a list of frames to the camera.
190  //
191  // Parameters:
192  //
193  // [in] Camera Camera to announce the frames too
194  // [in,out] pFrames storage for frame pointer, if they are NULL or have no sufficient space the frames will be created
195  // [in] nFrameCount number of frame pointers in pFrames
196  // [in] nPayloadSize payload size for one frame
197  // [out] nFramesAnnounced returns number of successful announced frames
198  // Returns:
199  //
200  // the first error that occurred or VmbErrorSuccess if non occurred
201  // Details: note the function will try to construct and announce nFrameCount frames t o the camera, even if some of them can not be created or announced, only if nFramesAnnounced == 0 the function was unsuccessful
202  //
203  static VmbErrorType AnnounceFrames(Camera &Camera, FramePtr *pFrames, VmbUint32_t nFrameCount, VmbInt64_t nPayloadSize, VmbUint32_t &nFramesAnnounced)
204  {
205  VmbErrorType Result = VmbErrorSuccess;
206  nFramesAnnounced = 0;
207  for( VmbUint32_t FrameNumber= 0; FrameNumber < nFrameCount; ++FrameNumber)
208  {
209  VmbErrorType LocalResult = SetupFrame( pFrames[ FrameNumber ], nPayloadSize); //< try to init frame
210  if( VmbErrorSuccess == LocalResult)
211  {
212  LocalResult = Camera.AnnounceFrame( pFrames[ FrameNumber] ); //< announce frame if successful initialized
213  if ( VmbErrorSuccess == LocalResult )
214  {
215  ++nFramesAnnounced;
216  }
217  else
218  {
219  std::stringstream strMsg("Could only successfully announce ");
220  strMsg << nFramesAnnounced << " of " << nFrameCount << " frames. Will continue with queuing those.";
221  LOG_FREE_TEXT( strMsg.str() );
222  }
223  }
224  if( VmbErrorSuccess == Result )
225  {
226  Result = LocalResult;
227  }
228  }
229  return Result;
230  }
231  //
232  // Method: AnnounceFrames
233  //
234  // Purpose: announce a FramePtrVector to the camera.
235  //
236  // Parameters:
237  // [in] Camera camera to announce the frames to
238  // [in,out] Frames vector of frame pointers that will contain the announced frames on return, can be empty on input
239  // [in] nBufferCount number of frames to announce, if nBufferCount > Frames.size() on return, some frames could not be announced
240  // [in] nPayloadSize frame payload size
241  // [in] Observer observer to attach to frames
242  //
243  static VmbErrorType AnnounceFrames(Camera &Camera, FramePtrVector &Frames, VmbUint32_t nBufferCount, VmbInt64_t nPayloadSize, const IFrameObserverPtr& Observer)
244  {
245  try
246  {
247  Frames.reserve( nBufferCount);
248  }
249  catch(...)
250  {
251  LOG_FREE_TEXT("could not allocate frames");
252  return VmbErrorResources;
253  }
254  VmbErrorType Result = VmbErrorSuccess;
255  for( VmbUint32_t i=0; i < nBufferCount; ++i)
256  {
257  FramePtr tmpFrame;
258  VmbErrorType LocalResult = SetupFrame( tmpFrame, nPayloadSize );
259  if( ! SP_ISNULL( tmpFrame) )
260  {
261  LocalResult = SP_ACCESS( tmpFrame)->RegisterObserver( Observer );
262  if( VmbErrorSuccess == LocalResult )
263  {
264  LocalResult = Camera.AnnounceFrame( tmpFrame);
265  if( VmbErrorSuccess == LocalResult )
266  {
267  Frames.push_back( tmpFrame );
268  }
269  else
270  {
271  LOG_FREE_TEXT("could not announce frame");
272  }
273  }
274  else
275  {
276  LOG_FREE_TEXT("could not register frame observer");
277  }
278  }
279  else
280  {
281  LOG_FREE_TEXT("could not allocate frame");
282  }
283  if( VmbErrorSuccess == Result)
284  {
285  Result = LocalResult;
286  }
287  }
288  return Result;
289  }
290  //
291  // Method: Prepare
292  //
293  // Purpose: prepare image grab for single image.
294  //
295  // Parameters:
296  //
297  // [in,out] pFrame frame to hold the image
298  // [in] PayloadSize frame payload size
299  //
300  VmbErrorType Prepare(FramePtr &pFrame, VmbInt64_t PayloadSize)
301  {
302  VmbErrorType res;
303  res = SetupFrame( pFrame, PayloadSize); // init frame if necessary
304  if ( VmbErrorSuccess != res )
305  {
306  LOG_FREE_TEXT("Could not create frame");
307  return res;
308  }
309  res = m_Camera.AnnounceFrame( pFrame ); // announce frame to camera
310  if ( VmbErrorSuccess != res )
311  {
312  LOG_FREE_TEXT("Could not Announce frame");
313  return res;
314  }
315  m_Tasks.push_back( RevokeFrame); // if successful announced we need to revoke frames
316  res = m_Camera.StartCapture(); // start capture logic
317  if ( VmbErrorSuccess != res )
318  {
319  LOG_FREE_TEXT( "Could not Start Capture" );
320  return res;
321  }
322  m_Tasks.push_back( EndCapture); // if capture logic is started we need end capture task
323  res = m_Camera.QueueFrame( pFrame ); // queue frame in processing logic
324  if ( VmbErrorSuccess != res )
325  {
326  LOG_FREE_TEXT( "Could not queue frame");
327  return res;
328  }
329  m_Tasks.pop_back();
330  m_Tasks.push_back( FlushQueue); // if frame queued we need flush queue task
331  m_Tasks.push_back( EndCapture);
332  FeaturePtr pFeature;
333  res = RunFeatureCommand( m_Camera, "AcquisitionStart" ); // start acquisition
334  if ( VmbErrorSuccess != res )
335  {
336  LOG_FREE_TEXT("Could not run command AcquisitionStart");
337  return res;
338  }
339  m_Tasks.push_back( AcquisitionStop);
340  return res;
341  }
342  // Method: Prepare
343  //
344  // Purpose: prepare image acquisition for multiple frames.
345  //
346  // Parameters:
347  //
348  // [in,out] pFrames non NULL pointer to field of frame pointers (can point to NULL) that hold the captured images
349  // [in] nFrameCount number of frames in vector
350  // [in] nPayLoadSize payload size
351  // [out] nFramesQueued returns number of successful queued images
352  //
353  VmbErrorType Prepare(FramePtr *pFrames, VmbUint32_t nFrameCount, VmbInt64_t nPayloadSize, VmbUint32_t &nFramesQueued )
354  {
355  if( NULL == pFrames || 0 == nFrameCount) // sanity check
356  {
357  return VmbErrorBadParameter;
358  }
359  nFramesQueued = 0;
360  VmbErrorType Result = VmbErrorSuccess;
361  VmbUint32_t FramesAnnounced = 0;
362  Result = AnnounceFrames( m_Camera, pFrames, nFrameCount, nPayloadSize, FramesAnnounced);
363  if( 0 == FramesAnnounced)
364  {
365  return Result;
366  }
367  m_Tasks.push_back( RevokeFrame); // add cleanup task for announced frames
368  Result = m_Camera.StartCapture(); // start capture logic
369  if ( VmbErrorSuccess != Result)
370  {
371  LOG_FREE_TEXT( "Could not Start Capture" );
372  return Result;
373  }
374  m_Tasks.push_back( EndCapture); // add cleanup task to end capture
375  for( VmbUint32_t FrameNumber = 0; FrameNumber < FramesAnnounced; ++FrameNumber)
376  {
377  Result = m_Camera.QueueFrame( pFrames[ FrameNumber ] ); // try queuing frame
378  if ( VmbErrorSuccess != Result )
379  {
380  std::stringstream strMsg("Could only successfully queue ");
381  strMsg << nFramesQueued << " of " << nFrameCount << " frames. Will continue with filling those.";
382  LOG_FREE_TEXT( strMsg.str() );
383  break;
384  }
385  else
386  {
387  ++nFramesQueued;
388  }
389  }
390  if( 0 == nFramesQueued) // we cannot capture anything, there are no frames queued
391  {
392  return Result;
393  }
394  m_Tasks.pop_back();
395  m_Tasks.push_back( FlushQueue); // if any frame was queued we need a cleanup task
396  m_Tasks.push_back( EndCapture);
397  FeaturePtr pFeature;
398  Result = RunFeatureCommand( m_Camera, "AcquisitionStart" ); // start acquisition logic
399  if ( VmbErrorSuccess != Result )
400  {
401  LOG_FREE_TEXT("Could not run command AcquisitionStart");
402  return Result;
403  }
404  m_Tasks.push_back( AcquisitionStop);
405  return Result;
406  }
407  //
408  // Method: TearDown
409  //
410  // Purpose: free all acquired resources.
411  //
413  {
415  while( ! m_Tasks.empty() )
416  {
417  VmbErrorType local_result = VmbErrorSuccess;
418  switch( GetTask() )
419  {
420  case AcquisitionStop:
421  local_result = RunFeatureCommand(m_Camera, "AcquisitionStop");
422  if( VmbErrorSuccess != local_result)
423  {
424  LOG_FREE_TEXT("Could not run command AquireStop");
425  }
426  break;
427  case EndCapture:
428  local_result = m_Camera.EndCapture();
429  if( VmbErrorSuccess != local_result)
430  {
431  LOG_FREE_TEXT("Could Not run EndCapture");
432  }
433  break;
434  case FlushQueue:
435  local_result = m_Camera.FlushQueue();
436  if( VmbErrorSuccess != local_result)
437  {
438  LOG_FREE_TEXT("Could not run Flush Queue command");
439  }
440  break;
441  case RevokeFrame:
442  local_result = m_Camera.RevokeAllFrames();
443  if( VmbErrorSuccess != local_result)
444  {
445  LOG_FREE_TEXT("Could Not Run Revoke Frames command");
446  }
447  break;
448  }
449  if( VmbErrorSuccess == res)
450  res = local_result;
451  }
452  return res;
453  }
454 };
455 
456 
458 {
459  // Copy of camera infos
460  struct CameraInfo
461  {
462  std::string cameraIdString; // Unique identifier for each camera
463  std::string cameraIdStringGigE; // GigE cameras can also be opened by IP or MAC address
464  std::string cameraName; // Name of the camera
465  std::string modelName; // Model name
466  std::string serialString; // Serial number
467  std::string interfaceIdString; // Unique value for each interface or bus
468  } m_cameraInfo;
469 
470  VmbInterfaceType m_eInterfaceType; // The type of the interface the camera is connected to
471 
474 
477 
478  VmbErrorType AppendFrameToVector( const FramePtr &frame );
479 };
480 
482 {
483  // No default ctor
484 }
485 
487 {
488  // No copy ctor
489 }
490 
492 {
493  // No assignment operator
494  return *this;
495 }
496 
497 Camera::Camera( const char *pID,
498  const char *pName,
499  const char *pModel,
500  const char *pSerialNumber,
501  const char *pInterfaceID,
502  VmbInterfaceType eInterfaceType )
503  : m_pImpl( new Impl() )
504  , m_persistType( -1 )
505  , m_maxIterations( -1 )
506  , m_loggingLevel( -1 )
507 {
508  m_pImpl->m_cameraInfo.cameraIdString.assign( pID ? pID : "" );
509  // TODO: Remove this with interface change
510  const char* pIDGigE = strstr( pID, AVT_IP_OR_MAC_ADDRESS);
511  if ( pIDGigE )
512  {
513  m_pImpl->m_cameraInfo.cameraIdStringGigE.assign( pIDGigE );
516  }
517  m_pImpl->m_cameraInfo.cameraName.assign( pName ? pName : "" );
518  m_pImpl->m_cameraInfo.interfaceIdString.assign( pInterfaceID ? pInterfaceID : "" );
519  m_pImpl->m_cameraInfo.modelName.assign( pModel ? pModel : "" );
520  m_pImpl->m_cameraInfo.serialString.assign( pSerialNumber ? pSerialNumber : "" );
521  m_pImpl->m_eInterfaceType = eInterfaceType;
522  m_pImpl->m_bAllowQueueFrame = true;
524 }
525 
527 {
528  Close();
529 
530  delete m_pImpl;
531 }
532 
534 {
535  VmbError_t res;
536  VmbHandle_t hHandle;
537 
538  if ( false == m_pImpl->m_cameraInfo.cameraIdStringGigE.empty() )
539  {
540  res = VmbCameraOpen( m_pImpl->m_cameraInfo.cameraIdStringGigE.c_str(), (VmbAccessMode_t)eAccessMode, &hHandle );
541  }
542  else
543  {
544  res = VmbCameraOpen( m_pImpl->m_cameraInfo.cameraIdString.c_str(), (VmbAccessMode_t)eAccessMode, &hHandle );
545  }
546 
547  if ( VmbErrorSuccess == res )
548  {
549  SetHandle( hHandle );
550  }
551 
552  return (VmbErrorType)res;
553 }
554 
556 {
558 
559  if ( NULL != GetHandle() )
560  {
561  if ( 0 < m_pImpl->m_frameHandlers.Vector.size()
562  && ( VmbErrorSuccess != EndCapture()
565  {
566  // Do some logging
567  LOG_FREE_TEXT( "Could not successfully revoke all frames")
568  }
569 
570  Reset();
571 
572  res = VmbCameraClose( GetHandle() );
573 
574  RevokeHandle();
575  }
576 
577  return (VmbErrorType)res;
578 }
579 
580 VmbErrorType Camera::GetID( char * const pStrID, VmbUint32_t &rnLength ) const
581 {
582  VmbErrorType res;
583 
584  if ( NULL == pStrID )
585  {
586  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.cameraIdString.length();
587  res = VmbErrorSuccess;
588  }
589  else if ( m_pImpl->m_cameraInfo.cameraIdString.length() <= rnLength )
590  {
591  std::copy( m_pImpl->m_cameraInfo.cameraIdString.begin(), m_pImpl->m_cameraInfo.cameraIdString.end(), pStrID );
592  pStrID[m_pImpl->m_cameraInfo.cameraIdString.length()] = '\0';
593  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.cameraIdString.length();
594  res = VmbErrorSuccess;
595  }
596  else
597  {
598  res = VmbErrorMoreData;
599  }
600 
601  return res;
602 }
603 
604 VmbErrorType Camera::GetName( char * const pStrName, VmbUint32_t &rnLength ) const
605 {
606  VmbErrorType res;
607 
608  if ( NULL == pStrName )
609  {
610  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.cameraName.length();
611  res = VmbErrorSuccess;
612  }
613  else if ( m_pImpl->m_cameraInfo.cameraName.length() <= rnLength )
614  {
615  std::copy( m_pImpl->m_cameraInfo.cameraName.begin(), m_pImpl->m_cameraInfo.cameraName.end(), pStrName );
616  pStrName[m_pImpl->m_cameraInfo.cameraName.length()] = '\0';
617  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.cameraName.length();
618  res = VmbErrorSuccess;
619  }
620  else
621  {
622  res = VmbErrorMoreData;
623  }
624 
625  return res;
626 }
627 
628 VmbErrorType Camera::GetModel( char * const pStrModel, VmbUint32_t &rnLength ) const
629 {
630  VmbErrorType res;
631 
632  if ( NULL == pStrModel )
633  {
634  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.modelName.length();
635  res = VmbErrorSuccess;
636  }
637  else if ( m_pImpl->m_cameraInfo.modelName.length() <= rnLength )
638  {
639  std::copy( m_pImpl->m_cameraInfo.modelName.begin(), m_pImpl->m_cameraInfo.modelName.end(), pStrModel );
640  pStrModel[m_pImpl->m_cameraInfo.modelName.length()] = '\0';
641  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.modelName.length();
642  res = VmbErrorSuccess;
643  }
644  else
645  {
646  res = VmbErrorMoreData;
647  }
648 
649  return res;
650 }
651 
652 VmbErrorType Camera::GetSerialNumber( char * const pStrSerial, VmbUint32_t &rnLength ) const
653 {
654  VmbErrorType res;
655 
656  if ( NULL == pStrSerial )
657  {
658  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.serialString.length();
659  res = VmbErrorSuccess;
660  }
661  else if ( m_pImpl->m_cameraInfo.serialString.length() <= rnLength )
662  {
663  std::copy( m_pImpl->m_cameraInfo.serialString.begin(), m_pImpl->m_cameraInfo.serialString.end(), pStrSerial );
664  pStrSerial[m_pImpl->m_cameraInfo.serialString.length()] = '\0';
665  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.serialString.length();
666  res = VmbErrorSuccess;
667  }
668  else
669  {
670  res = VmbErrorMoreData;
671  }
672 
673  return res;
674 }
675 
676 VmbErrorType Camera::GetInterfaceID( char * const pStrInterfaceID, VmbUint32_t &rnLength ) const
677 {
678  VmbErrorType res;
679 
680  if ( NULL == pStrInterfaceID )
681  {
682  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.interfaceIdString.length();
683  res = VmbErrorSuccess;
684  }
685  else if ( m_pImpl->m_cameraInfo.interfaceIdString.length() <= rnLength )
686  {
687  std::copy( m_pImpl->m_cameraInfo.interfaceIdString.begin(), m_pImpl->m_cameraInfo.interfaceIdString.end(), pStrInterfaceID );
688  pStrInterfaceID[m_pImpl->m_cameraInfo.interfaceIdString.length()] = '\0';
689  rnLength = (VmbUint32_t)m_pImpl->m_cameraInfo.interfaceIdString.length();
690  res = VmbErrorSuccess;
691  }
692  else
693  {
694  res = VmbErrorMoreData;
695  }
696 
697  return res;
698 }
699 
701 {
702  reInterfaceType = m_pImpl->m_eInterfaceType;
703 
704  return VmbErrorSuccess;
705 }
706 
708 {
709  VmbError_t res;
710  VmbCameraInfo_t info;
711 
712  if ( false == m_pImpl->m_cameraInfo.cameraIdStringGigE.empty() )
713  {
714  res = VmbCameraInfoQuery( m_pImpl->m_cameraInfo.cameraIdStringGigE.c_str(), &info, sizeof( VmbCameraInfo_t ));
715  }
716  else
717  {
718  res = VmbCameraInfoQuery( m_pImpl->m_cameraInfo.cameraIdString.c_str(), &info, sizeof( VmbCameraInfo_t ));
719  }
720 
721  if ( VmbErrorSuccess == res )
722  {
723  rePermittedAccess = (VmbAccessModeType)info.permittedAccess;
724  }
725 
726  return (VmbErrorType)res;
727 }
728 
729 VmbErrorType Camera::ReadRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t nAddressSize, VmbUint64_t *pDataArray, VmbUint32_t *pCompletedReads ) const
730 {
731  return static_cast<VmbErrorType>( VmbRegistersRead( GetHandle(), nAddressSize, pAddressArray, pDataArray, pCompletedReads ) );
732 }
733 
734 VmbErrorType Camera::WriteRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t nAddressSize, const VmbUint64_t *pDataArray, VmbUint32_t *pCompletedWrites )
735 {
736  return static_cast<VmbErrorType>( VmbRegistersWrite( GetHandle(), nAddressSize, pAddressArray, pDataArray, pCompletedWrites ) );
737 }
738 
739 VmbErrorType Camera::ReadMemory( const VmbUint64_t address, VmbUchar_t *pBuffer, VmbUint32_t nBufferSize, VmbUint32_t *pSizeComplete ) const
740 {
741  return static_cast<VmbErrorType>( VmbMemoryRead( GetHandle(), address, nBufferSize, (char*)pBuffer, pSizeComplete ) );
742 }
743 
744 VmbErrorType Camera::WriteMemory( const VmbUint64_t address, const VmbUchar_t *pBuffer, VmbUint32_t nBufferSize, VmbUint32_t *pSizeComplete )
745 {
746  return static_cast<VmbErrorType>( VmbMemoryWrite( GetHandle(), address, nBufferSize, (char *)pBuffer, pSizeComplete ) );
747 }
748 
749 //Get one image synchronously.
751 {
752  VmbErrorType res;
753  VmbInt64_t PayloadSize;
754  FeaturePtr pFeature;
755 
756  res = GetFeatureValueInt( *this, "PayloadSize", PayloadSize );
757  if ( VmbErrorSuccess == res )
758  {
759  AcquireImageHelper AcquireHelper( *this );
760  res = AcquireHelper.Prepare( rFrame, PayloadSize );
761  if ( VmbErrorSuccess == res )
762  {
763  res = (VmbErrorType)VmbCaptureFrameWait( GetHandle(), &(SP_ACCESS( rFrame )->m_pImpl->m_frame), nTimeout );
764  if ( VmbErrorSuccess != res )
765  {
766  LOG_FREE_TEXT( "Could not acquire single image." )
767  }
768  }
769  else
770  {
771  LOG_FREE_TEXT( "Preparing image acquisition failed." );
772  }
773  VmbErrorType local_result = AcquireHelper.TearDown();
774  if( VmbErrorSuccess != local_result )
775  {
776  LOG_FREE_TEXT( "Tear down capture logic failed." )
777  if( VmbErrorSuccess == res)
778  {
779  res = local_result;
780  }
781  }
782  }
783  else
784  {
785  LOG_FREE_TEXT( "Could not get payload size" );
786  }
787 
788  return res;
789 }
790 
791 VmbErrorType Camera::AcquireMultipleImages( FramePtr *pFrames, VmbUint32_t nSize, VmbUint32_t nTimeout, VmbUint32_t *pNumFramesCompleted )
792 {
794 
795  if ( NULL == pFrames
796  || 0 == nSize )
797  {
798  return res;
799  }
800 
801  if ( NULL != pNumFramesCompleted )
802  {
803  *pNumFramesCompleted = 0;
804  }
805 
806  VmbInt64_t nPayloadSize;
807  FeaturePtr pFeature;
808 
809  res = GetFeatureValueInt( *this, "PayloadSize", nPayloadSize );
810  if ( VmbErrorSuccess == res )
811  {
812  AcquireImageHelper AquireHelper( *this );
813  VmbUint32_t nFramesQueued = 0;
814  res = AquireHelper.Prepare( pFrames, nSize, nPayloadSize, nFramesQueued);
815 
816  if ( VmbErrorSuccess == res )
817  {
818  for ( VmbUint32_t nFrameCount = 0; nFrameCount <nFramesQueued; ++ nFrameCount )
819  {
820  res = (VmbErrorType)VmbCaptureFrameWait( GetHandle(), &(SP_ACCESS( pFrames[nFrameCount] )->m_pImpl->m_frame), nTimeout );
821  if ( VmbErrorSuccess != res )
822  {
823  std::stringstream strMsg("Could only successfully fill ");
824  strMsg << nFrameCount-1 << " of " << nSize << " frames. Will stop acquisition now.";
825  LOG_FREE_TEXT( strMsg.str() );
826  break;
827  }
828  else if ( NULL != pNumFramesCompleted )
829  {
830  ++(*pNumFramesCompleted);
831  }
832  }
833  VmbErrorType local_res = AquireHelper.TearDown();
834  if( VmbErrorSuccess == res)
835  {
836  res = local_res;
837  }
838  }
839  else
840  {
841  LOG_FREE_TEXT( "Could not start capture" )
842  }
843  }
844  else
845  {
846  LOG_FREE_TEXT( "Could not get feature PayloadSize");
847  }
848 
849  return res;
850 }
851 
852 VmbErrorType Camera::StartContinuousImageAcquisition( int nBufferCount, const IFrameObserverPtr &rObserver )
853 {
854  VmbErrorType res;
855  FramePtrVector Frames;
856  VmbInt64_t nPayloadSize;
857 
858  res = GetFeatureValueInt(*this,"PayloadSize", nPayloadSize );
859  if ( VmbErrorSuccess == res )
860  {
861  res = AcquireImageHelper::AnnounceFrames( *this, Frames, nBufferCount, nPayloadSize, rObserver );
862  if( Frames.empty() )
863  {
864  return res;
865  }
866  res = StartCapture();
867  if ( VmbErrorSuccess == res )
868  {
869  VmbUint32_t FramesQueued = 0;
870  for ( size_t FrameNumber = 0; FrameNumber < Frames.size(); ++ FrameNumber )
871  {
872  VmbErrorType LocalResult = QueueFrame( Frames[ FrameNumber] );
873  if ( VmbErrorSuccess == LocalResult)
874  {
875  ++FramesQueued;
876  }
877  else
878  {
879  LOG_FREE_TEXT( "Could not queue frame" )
880  }
881  if( VmbErrorSuccess == res)
882  {
883  res = LocalResult;
884  }
885  }
886  if( 0 != FramesQueued)
887  {
888  res = RunFeatureCommand(*this, "AcquisitionStart" );
889  if ( VmbErrorSuccess != res )
890  {
891  EndCapture();
892  FlushQueue();
893  RevokeAllFrames();
894  LOG_FREE_TEXT( "Could not start acquisition" )
895  return res;
896  }
897 
898  }
899  else
900  {
901  EndCapture();
902  RevokeAllFrames();
903  LOG_FREE_TEXT( "Could not queue frames" )
904  return res;
905  }
906 
907  }
908  else
909  {
910  RevokeAllFrames();
911  LOG_FREE_TEXT( "Could not start capturing" )
912  }
913  }
914  else
915  {
916  LOG_FREE_TEXT( "Could not get feature PayloadSize" )
917  }
918 
919  return res;
920 }
921 
923 {
924  VmbErrorType res;
925  FeaturePtr pFeature;
926 
927  // Prevent queuing of new frames while stopping
929  m_pImpl->m_bAllowQueueFrame = false;
930  guard.Release();
931 
932  res = RunFeatureCommand( *this, "AcquisitionStop" );
933  if ( VmbErrorSuccess != res )
934  {
935  LOG_FREE_TEXT( "Could not run feature AcquisitionStop" )
936  }
937 
938  res = EndCapture();
939  if ( VmbErrorSuccess == res )
940  {
941  res = FlushQueue();
942  if( VmbErrorSuccess != res)
943  {
944  LOG_FREE_TEXT( "Could not flush queue" )
945  }
946  res = RevokeAllFrames();
947  if ( VmbErrorSuccess != res )
948  {
949  LOG_FREE_TEXT( "Could not revoke frames" )
950  }
951  }
952  else
953  {
954  LOG_FREE_TEXT("Could not stop capture, unable to revoke frames")
955  }
956 
958  m_pImpl->m_bAllowQueueFrame = true;
959 
960  return res;
961 }
962 
964 {
965  if ( SP_ISNULL( frame ))
966  {
967  return VmbErrorBadParameter;
968  }
969 
970  if ( true == SP_ACCESS( frame )->m_pImpl->m_bAlreadyAnnounced
971  || true == SP_ACCESS( frame )->m_pImpl->m_bAlreadyQueued )
972  {
973  return VmbErrorInvalidCall;
974  }
975 
976  VmbError_t res = VmbFrameAnnounce( GetHandle(), &(SP_ACCESS( frame )->m_pImpl->m_frame), sizeof SP_ACCESS( frame )->m_pImpl->m_frame );
977 
978  if ( VmbErrorSuccess == res )
979  {
980  // Begin write lock frame handler list
982  {
983  res = m_pImpl->AppendFrameToVector( frame ) ;
984  if( VmbErrorSuccess == res )
985  {
986  SP_ACCESS( frame )->m_pImpl->m_bAlreadyAnnounced = true;
987  }
988  else
989  {
990  LOG_FREE_TEXT("could not append frame to internal vector");
991  }
992  // End write lock frame handler list
994  }
995  else
996  {
997  LOG_FREE_TEXT( "Could not lock announced frame queue for appending frame." );
998  res = VmbErrorResources;
999  }
1000  }
1001 
1002  return static_cast<VmbErrorType>( res );
1003 }
1004 
1006 {
1007  if ( SP_ISNULL( frame ))
1008  {
1009  return VmbErrorBadParameter;
1010  }
1011 
1012  VmbError_t res = VmbFrameRevoke( GetHandle(), &(SP_ACCESS( frame )->m_pImpl->m_frame) );
1013 
1014  if ( VmbErrorSuccess == res )
1015  {
1016  // Begin (exclusive) write lock frame handler list
1018  {
1019  // Dequeue, revoke and delete frame
1020  for( FrameHandlerPtrVector::iterator iter = m_pImpl->m_frameHandlers.Vector.begin();
1021  m_pImpl->m_frameHandlers.Vector.end() != iter;)
1022  {
1023  // Begin exclusive write lock frame handler
1024  if ( true == SP_ACCESS(( *iter ))->EnterWriteLock( true ))
1025  {
1026  if ( SP_ISEQUAL( frame, SP_ACCESS(( *iter ))->GetFrame() ))
1027  {
1028  SP_ACCESS( frame )->m_pImpl->m_frame.context[FRAME_HDL] = NULL;
1029  SP_ACCESS( frame )->m_pImpl->m_bAlreadyQueued = false;
1030  SP_ACCESS( frame )->m_pImpl->m_bAlreadyAnnounced = false;
1031  // End exclusive write lock frame handler
1032  SP_ACCESS(( *iter ))->ExitWriteLock();
1033  iter = m_pImpl->m_frameHandlers.Vector.erase( iter );
1034  return VmbErrorSuccess;
1035  }
1036  else
1037  {
1038  // End exclusive write lock frame handler
1039  SP_ACCESS(( *iter ))->ExitWriteLock();
1040 
1041  ++iter;
1042  }
1043  }
1044  }
1045 
1046  // End (exclusive) write lock frame handler list
1048  }
1049  else
1050  {
1051  LOG_FREE_TEXT( "Could not lock announced frame queue for removing frame." );
1052  res = VmbErrorResources;
1053  }
1054  }
1055  else
1056  {
1057  LOG_FREE_TEXT( "Could not revoke frames" )
1058  }
1059 
1060  return (VmbErrorType)res;
1061 }
1062 
1064 {
1065  VmbError_t res;
1066 
1067  res = VmbFrameRevokeAll( GetHandle() );
1068 
1069  if ( VmbErrorSuccess == res )
1070  {
1071  // Begin (exclusive) write lock frame handler list
1073  {
1074  // Dequeue, revoke and delete frames
1075  for ( FrameHandlerPtrVector::iterator iter = m_pImpl->m_frameHandlers.Vector.begin();
1076  m_pImpl->m_frameHandlers.Vector.end() != iter;
1077  ++iter )
1078  {
1079  // Begin exclusive write lock frame handler
1080  if ( true == SP_ACCESS(( *iter ))->EnterWriteLock( true ))
1081  {
1082  SP_ACCESS( SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_frame.context[FRAME_HDL] = NULL;
1083  SP_ACCESS( SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_bAlreadyQueued = false;
1084  SP_ACCESS (SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_bAlreadyAnnounced = false;
1085  // End exclusive write lock frame handler
1086  SP_ACCESS(( *iter ))->ExitWriteLock();
1087  }
1088  else
1089  {
1090  LOG_FREE_TEXT( "Could not lock frame handler.")
1091  }
1092  }
1093 
1094  m_pImpl->m_frameHandlers.Vector.clear();
1095 
1096  // End exclusive write lock frame handler list
1098  }
1099  else
1100  {
1101  LOG_FREE_TEXT( "Could not lock frame handler list.")
1102  }
1103  }
1104 
1105  return (VmbErrorType)res;
1106 }
1107 
1109 {
1110  if ( SP_ISNULL( frame ))
1111  {
1112  return VmbErrorBadParameter;
1113  }
1114 
1116  if ( false == m_pImpl->m_bAllowQueueFrame )
1117  {
1118  LOG_FREE_TEXT( "Queuing of new frames is not possible while flushing and revoking the currently queued frames." );
1119  return VmbErrorInvalidCall;
1120  }
1121 
1122  // HINT: The same frame cannot be queued twice (VmbErrorOther)
1124 
1125  if ( VmbErrorSuccess == res
1126  && false == SP_ACCESS( frame )->m_pImpl->m_bAlreadyQueued )
1127  {
1128  if ( false == SP_ACCESS( frame )->m_pImpl->m_bAlreadyAnnounced )
1129  {
1130  // Begin write lock frame handler list
1132  {
1133  m_pImpl->AppendFrameToVector( frame );
1134  SP_ACCESS( frame )->m_pImpl->m_bAlreadyQueued = true;
1135 
1136  // End write lock frame handler list
1138  }
1139  else
1140  {
1141  LOG_FREE_TEXT( "Could not lock frame queue for appending frame." );
1142  res = VmbErrorResources;
1143  }
1144  }
1145  }
1146 
1147  return static_cast<VmbErrorType>( res );
1148 }
1149 
1151 {
1153 
1154  if ( VmbErrorSuccess == res )
1155  {
1156  // Begin exclusive write lock frame handler list
1158  {
1159  for ( FrameHandlerPtrVector::iterator iter = m_pImpl->m_frameHandlers.Vector.begin();
1160  m_pImpl->m_frameHandlers.Vector.end() != iter;)
1161  {
1162  // Begin exclusive write lock of every single frame handler
1163  if ( true == SP_ACCESS(( *iter ))->EnterWriteLock( true ))
1164  {
1165  // Dequeue frame
1166  SP_ACCESS( SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_bAlreadyQueued = false;
1167  if ( false == SP_ACCESS( SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_bAlreadyAnnounced )
1168  {
1169  // Delete frame if it was not announced / was revoked before
1170  SP_ACCESS( SP_ACCESS(( *iter ))->GetFrame() )->m_pImpl->m_frame.context[FRAME_HDL] = NULL;
1171  // End write lock frame handler
1172  SP_ACCESS(( *iter ))->ExitWriteLock();
1173  iter = m_pImpl->m_frameHandlers.Vector.erase( iter );
1174  }
1175  else
1176  {
1177  // End write lock frame handler
1178  SP_ACCESS(( *iter ))->ExitWriteLock();
1179  ++iter;
1180  }
1181  }
1182  else
1183  {
1184  LOG_FREE_TEXT( "Could not lock frame handler." );
1185  }
1186  }
1187  // End write lock frame handler list
1189  }
1190  else
1191  {
1192  LOG_FREE_TEXT( "Could not lock frame handler list." )
1193  }
1194  }
1195  else
1196  {
1197  LOG_FREE_TEXT( "Could not flush frame queue" )
1198  }
1199 
1200  return static_cast<VmbErrorType>( res );
1201 }
1202 
1204 {
1205  return static_cast<VmbErrorType>( VmbCaptureStart( GetHandle() ) );
1206 }
1207 
1209 {
1210  VmbError_t res = VmbCaptureEnd( GetHandle() );
1211 
1212  return static_cast<VmbErrorType>( res );
1213 }
1214 
1216 {
1217  try
1218  {
1219  FrameHandlerPtr pFH( new FrameHandler( rFrame, SP_ACCESS( rFrame )->m_pImpl->m_pObserver ));
1220  if( SP_ISNULL( pFH ) )
1221  {
1222  return VmbErrorResources;
1223  }
1224  SP_ACCESS( rFrame )->m_pImpl->m_frame.context[FRAME_HDL] = SP_ACCESS(pFH);
1225  m_frameHandlers.Vector.push_back( pFH );
1226  return VmbErrorSuccess;
1227  }
1228  catch(...)
1229  {
1230  return VmbErrorResources;
1231  }
1232 }
1233 
1234 //
1235 // Method: SaveCameraSettings()
1236 //
1237 // Purpose: Saves the current camera setup to an XML file
1238 //
1239 // Parameters:
1240 //
1241 // [in] pStrFileName xml file name
1242 // [in] pSettings pointer to settings struct
1243 //
1244 // Returns:
1245 //
1246 // - VmbErrorSuccess: If no error
1247 // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
1248 // - VmbErrorBadHandle: The given handle is not valid
1249 // - VmbErrorInternalFault: When something unexpected happens in VimbaC function
1250 // - VmbErrorOther: Every other failure in load/save settings implementation class
1251 //
1252 VmbErrorType Camera::SaveCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const
1253 {
1255 
1256 // parameter check
1257  if( NULL == pStrFileName )
1258  {
1259  return VmbErrorBadParameter;
1260  }
1261 
1262 // get handle
1263  VmbHandle_t handle = GetHandle();
1264 
1265  if( NULL == pSettings )
1266  {
1267  err = (VmbErrorType)VmbCameraSettingsSave( handle, pStrFileName, NULL, 0 );
1268  }
1269  else
1270  {
1271  err = (VmbErrorType)VmbCameraSettingsSave( handle, pStrFileName, pSettings, sizeof(pSettings) );
1272  }
1273 
1274  return err;
1275 }
1276 
1277 //
1278 // Method: LoadCameraSettings()
1279 //
1280 // Purpose: Loads the current camera setup from an XML file into the camera
1281 //
1282 // Parameters:
1283 //
1284 // [in] pStrFileName xml file name
1285 // [in] pSettings pointer to settings struct
1286 //
1287 // Returns:
1288 //
1289 // - VmbErrorSuccess: If no error
1290 // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
1291 // - VmbErrorBadHandle: The given handle is not valid
1292 // - VmbErrorInternalFault: When something unexpected happens in VimbaC function
1293 // - VmbErrorOther: Every other failure in load/save settings implementation class
1294 //
1295 VmbErrorType Camera::LoadCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const
1296 {
1298 
1299 // parameter check
1300  if( NULL == pStrFileName )
1301  {
1302  return VmbErrorBadParameter;
1303  }
1304 
1305 // get handle
1306  VmbHandle_t handle = GetHandle();
1307 
1308  if( NULL == pSettings )
1309  {
1310  err = (VmbErrorType)VmbCameraSettingsLoad( handle, pStrFileName, NULL, 0 );
1311  }
1312  else
1313  {
1314  err = (VmbErrorType)VmbCameraSettingsLoad( handle, pStrFileName, pSettings, sizeof(pSettings) );
1315  }
1316 
1317  return err;
1318 }
1319 
1320 //
1321 // Method: LoadSaveSettingsSetup()
1322 //
1323 // Purpose: Sets Load/Save settings behaviour (alternative to settings struct)
1324 //
1325 // Parameters:
1326 //
1327 // [in] persistType determines which feature shall be considered during load/save settings
1328 // [in] maxIterations determines how many 'tries' during loading feature values shall be performed
1329 // [in] loggingLevel determines level of detail for load/save settings logging
1330 //
1331 void Camera::LoadSaveSettingsSetup( VmbFeaturePersist_t persistType, VmbUint32_t maxIterations, VmbUint32_t loggingLevel )
1332 {
1333  if( true == ((VmbFeaturePersistAll != persistType) && (VmbFeaturePersistStreamable != persistType) && (VmbFeaturePersistNoLUT != persistType)) )
1334  {
1336  }
1337  else
1338  {
1339  m_persistType = persistType;
1340  }
1341 
1342  if( false == ((0 < maxIterations) && (6 > maxIterations)) )
1343  {
1344  m_maxIterations = 5;
1345  }
1346  else
1347  {
1348  m_maxIterations = maxIterations;
1349  }
1350 
1351  if( false == ((0 < loggingLevel) && (5 > loggingLevel)) )
1352  {
1353  m_loggingLevel = 4;
1354  }
1355  else
1356  {
1357  m_loggingLevel = loggingLevel;
1358  }
1359 }
1360 
1361 }} // namespace AVT::VmbAPI
VmbInt32_t VmbError_t
virtual IMEXPORT VmbErrorType Close()
Definition: Camera.cpp:555
virtual IMEXPORT ~Camera()
Definition: Camera.cpp:526
IMEXPORT VmbErrorType GetFeatureByName(const char *pName, FeaturePtr &pFeature)
IMEXPORT VmbErrorType AcquireSingleImage(FramePtr &pFrame, VmbUint32_t timeout)
Definition: Camera.cpp:750
bool EnterWriteLock(BasicLockable &rLockable, bool bExclusive=false)
#define SP_ISNULL(sp)
NetPointer< Frame, AVT::VmbAPINET::Frame > FramePtr
std::vector< T > Vector
Definition: Helper.h:41
IMEXPORTC VmbError_t VMB_CALL VmbRegistersWrite(const VmbHandle_t handle, VmbUint32_t writeCount, const VmbUint64_t *pAddressArray, const VmbUint64_t *pDataArray, VmbUint32_t *pNumCompleteWrites)
IMEXPORTC VmbError_t VMB_CALL VmbCaptureFrameQueue(const VmbHandle_t cameraHandle, const VmbFrame_t *pFrame, VmbFrameCallback callback)
VmbUint32_t VmbAccessMode_t
Definition: VimbaC.h:130
long long VmbInt64_t
ConditionHelper m_conditionHelper
Definition: Camera.cpp:473
#define SP_ACCESS(sp)
IMEXPORTC VmbError_t VMB_CALL VmbRegistersRead(const VmbHandle_t handle, VmbUint32_t readCount, const VmbUint64_t *pAddressArray, VmbUint64_t *pDataArray, VmbUint32_t *pNumCompleteReads)
VmbInterfaceType m_eInterfaceType
Definition: Camera.cpp:470
IMEXPORTC VmbError_t VMB_CALL VmbMemoryRead(const VmbHandle_t handle, VmbUint64_t address, VmbUint32_t bufferSize, char *dataBuffer, VmbUint32_t *pSizeComplete)
IMEXPORTC VmbError_t VMB_CALL VmbCameraClose(const VmbHandle_t cameraHandle)
IMEXPORTC VmbError_t VMB_CALL VmbCaptureStart(const VmbHandle_t cameraHandle)
const AcquireImageHelper & operator=(const AcquireImageHelper &o)
virtual VmbErrorType ReadRegisters(const Uint64Vector &addresses, Uint64Vector &buffer) const
virtual IMEXPORT VmbErrorType Open(VmbAccessModeType accessMode)
Definition: Camera.cpp:533
static VmbErrorType AnnounceFrames(Camera &Camera, FramePtrVector &Frames, VmbUint32_t nBufferCount, VmbInt64_t nPayloadSize, const IFrameObserverPtr &Observer)
Definition: Camera.cpp:243
VmbAccessMode_t permittedAccess
Definition: VimbaC.h:156
char const *const AVT_IP_OR_MAC_ADDRESS
Definition: Helper.h:51
static void VMB_CALL FrameDoneCallback(const VmbHandle_t handle, VmbFrame_t *pFrame)
struct AVT::VmbAPI::Camera::Impl::CameraInfo m_cameraInfo
IMEXPORTC VmbError_t VMB_CALL VmbCaptureFrameWait(const VmbHandle_t cameraHandle, const VmbFrame_t *pFrame, VmbUint32_t timeout)
IMEXPORTC VmbError_t VMB_CALL VmbCameraSettingsSave(const VmbHandle_t handle, const char *fileName, VmbFeaturePersistSettings_t *pSettings, VmbUint32_t sizeofSettings)
VmbErrorType GetID(std::string &cameraID) const
VmbErrorType LoadCameraSettings(std::string fileName, VmbFeaturePersistSettings_t *pSettings=0) const
void ExitWriteLock(BasicLockable &rLockable)
void Protect(MutexPtr pMutex)
Definition: MutexGuard.cpp:74
VmbErrorType
virtual VmbErrorType WriteMemory(const VmbUint64_t &address, const UcharVector &buffer)
VmbErrorType GetSerialNumber(std::string &serialNumber) const
VmbAccessModeType
Definition: VimbaC.h:122
VmbUint32_t m_maxIterations
Definition: Camera.h:624
#define LOG_FREE_TEXT(txt)
Definition: LoggerDefines.h:57
IMEXPORTC VmbError_t VMB_CALL VmbFrameRevokeAll(const VmbHandle_t cameraHandle)
unsigned char VmbUchar_t
void * VmbHandle_t
IMEXPORT void LoadSaveSettingsSetup(VmbFeaturePersist_t persistType, VmbUint32_t maxIterations, VmbUint32_t loggingLevel)
Definition: Camera.cpp:1331
static VmbErrorType SetupFrame(FramePtr &pFrame, VmbInt64_t PayloadSize)
Definition: Camera.cpp:138
IMEXPORTC VmbError_t VMB_CALL VmbCameraInfoQuery(const char *idString, VmbCameraInfo_t *pInfo, VmbUint32_t sizeofCameraInfo)
NetPointer< Feature, AVT::VmbAPINET::Feature > FeaturePtr
IMEXPORT VmbErrorType GetPermittedAccess(VmbAccessModeType &permittedAccess) const
Definition: Camera.cpp:707
VmbErrorType SaveCameraSettings(std::string fileName, VmbFeaturePersistSettings_t *pSettings=0) const
Camera & operator=(const Camera &)
Definition: Camera.cpp:491
IMEXPORTC VmbError_t VMB_CALL VmbFrameAnnounce(const VmbHandle_t cameraHandle, const VmbFrame_t *pFrame, VmbUint32_t sizeofFrame)
LockableVector< FrameHandlerPtr > m_frameHandlers
Definition: Camera.cpp:472
unsigned long long VmbUint64_t
std::vector< FramePtr > FramePtrVector
Definition: Frame.h:335
VmbErrorType AcquireMultipleImages(FramePtrVector &frames, VmbUint32_t timeout)
IMEXPORTC VmbError_t VMB_CALL VmbMemoryWrite(const VmbHandle_t handle, VmbUint64_t address, VmbUint32_t bufferSize, const char *dataBuffer, VmbUint32_t *pSizeComplete)
VmbErrorType Prepare(FramePtr &pFrame, VmbInt64_t PayloadSize)
Definition: Camera.cpp:300
IMEXPORT VmbErrorType FlushQueue()
Definition: Camera.cpp:1150
IMEXPORTC VmbError_t VMB_CALL VmbFrameRevoke(const VmbHandle_t cameraHandle, const VmbFrame_t *pFrame)
#define SP_SET(sp, rawPtr)
VmbErrorType Prepare(FramePtr *pFrames, VmbUint32_t nFrameCount, VmbInt64_t nPayloadSize, VmbUint32_t &nFramesQueued)
Definition: Camera.cpp:353
#define SP_ISEQUAL(sp1, sp2)
IMEXPORT VmbErrorType QueueFrame(const FramePtr &pFrame)
Definition: Camera.cpp:1108
VmbInterfaceType
Definition: VimbaC.h:107
VmbFeaturePersist_t m_persistType
Definition: Camera.h:623
tear_down_tasks GetTask()
get the top most taks and pop it from stack
Definition: Camera.cpp:123
VmbUint32_t VmbFeaturePersist_t
Definition: VimbaC.h:1881
VmbUint32_t m_loggingLevel
Definition: Camera.h:625
static VmbErrorType AnnounceFrames(Camera &Camera, FramePtr *pFrames, VmbUint32_t nFrameCount, VmbInt64_t nPayloadSize, VmbUint32_t &nFramesAnnounced)
Definition: Camera.cpp:203
VmbErrorType GetModel(std::string &model) const
IMEXPORT VmbErrorType StopContinuousImageAcquisition()
Definition: Camera.cpp:922
VmbErrorType AppendFrameToVector(const FramePtr &frame)
Definition: Camera.cpp:1215
std::vector< tear_down_tasks > task_storage
Definition: Camera.cpp:119
IMEXPORT VmbErrorType StartCapture()
Definition: Camera.cpp:1203
VmbErrorType RunFeatureCommand(Camera &cam, const char *name)
Definition: Camera.cpp:85
IMEXPORTC VmbError_t VMB_CALL VmbCameraSettingsLoad(const VmbHandle_t handle, const char *fileName, VmbFeaturePersistSettings_t *pSettings, VmbUint32_t sizeofSettings)
unsigned int VmbUint32_t
IMEXPORT VmbErrorType RevokeFrame(const FramePtr &pFrame)
Definition: Camera.cpp:1005
virtual VmbErrorType ReadMemory(const VmbUint64_t &address, UcharVector &buffer) const
virtual VmbErrorType WriteRegisters(const Uint64Vector &addresses, const Uint64Vector &buffer)
VmbErrorType GetInterfaceID(std::string &interfaceID) const
IMEXPORT VmbErrorType StartContinuousImageAcquisition(int bufferCount, const IFrameObserverPtr &pObserver)
Definition: Camera.cpp:852
IMEXPORTC VmbError_t VMB_CALL VmbCameraOpen(const char *idString, VmbAccessMode_t accessMode, VmbHandle_t *pCameraHandle)
void SetHandle(const VmbHandle_t handle)
VmbErrorType GetFeatureValueInt(Camera &cam, const char *name, VmbInt64_t &val)
Definition: Camera.cpp:54
IMEXPORT VmbErrorType RevokeAllFrames()
Definition: Camera.cpp:1063
IMEXPORTC VmbError_t VMB_CALL VmbCaptureEnd(const VmbHandle_t cameraHandle)
IMEXPORT VmbErrorType GetInterfaceType(VmbInterfaceType &interfaceType) const
Definition: Camera.cpp:700
IMEXPORT VmbErrorType EndCapture()
Definition: Camera.cpp:1208
IMEXPORTC VmbError_t VMB_CALL VmbCaptureQueueFlush(const VmbHandle_t cameraHandle)
VmbErrorType GetName(std::string &name) const
IMEXPORT VmbErrorType AnnounceFrame(const FramePtr &pFrame)
Definition: Camera.cpp:963


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