Camera.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*=============================================================================
  2. Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
  3. Redistribution of this file, in original or modified form, without
  4. prior written consent of Allied Vision Technologies is prohibited.
  5. -------------------------------------------------------------------------------
  6. File: Camera.h
  7. Description: Definition of class AVT::VmbAPI::Camera.
  8. -------------------------------------------------------------------------------
  9. THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  10. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
  11. NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  12. DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  13. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  14. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  15. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  16. AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  17. TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  18. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19. =============================================================================*/
  20. #ifndef AVT_VMBAPI_CAMERA_H
  21. #define AVT_VMBAPI_CAMERA_H
  22. #include <vector>
  23. #include <string>
  24. #include <VimbaC/Include/VimbaC.h>
  25. #include <VimbaCPP/Include/VimbaCPPCommon.h>
  26. #include <VimbaCPP/Include/IRegisterDevice.h>
  27. #include <VimbaCPP/Include/FeatureContainer.h>
  28. #include <VimbaCPP/Include/Frame.h>
  29. #include <VimbaCPP/Include/IFrameObserver.h>
  30. #include <VimbaCPP/Include/SharedPointerDefines.h>
  31. namespace AVT {
  32. namespace VmbAPI {
  33. typedef std::vector<CameraPtr> CameraPtrVector;
  34. class Camera : public FeatureContainer, public IRegisterDevice
  35. {
  36. public:
  37. //
  38. // Method: Camera constructor
  39. //
  40. // Purpose: Creates an instance of class Camera
  41. //
  42. // Parameters:
  43. //
  44. // [in ] const char* pID The ID of the camera
  45. // [in ] const char* pName The name of the camera
  46. // [in ] const char* pModel The model name of the camera
  47. // [in ] const char* pSerialNumber The serial number of the camera
  48. // [in ] const char* pInterfaceID The ID of the interface the camera is connected to
  49. // [in ] VmbInterfaceType interfaceType The type of the interface the camera is connected to
  50. //
  51. // Details: The ID of the camera may be, among others, one of the following: "169.254.12.13",
  52. // "000f31000001", a plain serial number: "1234567890", or the device ID
  53. // of the underlying transport layer.
  54. //
  55. IMEXPORT Camera( const char *pID,
  56. const char *pName,
  57. const char *pModel,
  58. const char *pSerialNumber,
  59. const char *pInterfaceID,
  60. VmbInterfaceType interfaceType );
  61. //
  62. // Method: Camera destructor
  63. //
  64. // Purpose: Destroys an instance of class Camera
  65. //
  66. // Details: Destroying a camera implicitly closes it beforehand.
  67. //
  68. IMEXPORT virtual ~Camera();
  69. //
  70. // Method: Open()
  71. //
  72. // Purpose: Opens the specified camera.
  73. //
  74. // Parameters:
  75. //
  76. // [in ] VmbAccessMode_t accessMode Access mode determines the level of control you have on the camera
  77. //
  78. // Returns:
  79. //
  80. // - VmbErrorSuccess: If no error
  81. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  82. // - VmbErrorNotFound: The designated camera cannot be found
  83. // - VmbErrorInvalidAccess: Operation is invalid with the current access mode
  84. //
  85. // Details: A camera may be opened in a specific access mode. This mode determines
  86. // the level of control you have on a camera.
  87. //
  88. IMEXPORT virtual VmbErrorType Open( VmbAccessModeType accessMode );
  89. //
  90. // Method: Close()
  91. //
  92. // Purpose: Closes the specified camera.
  93. //
  94. // Returns:
  95. //
  96. // - VmbErrorSuccess: If no error
  97. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  98. //
  99. // Details: Depending on the access mode this camera was opened in, events are killed,
  100. // callbacks are unregistered, the frame queue is cleared, and camera control is released.
  101. //
  102. IMEXPORT virtual VmbErrorType Close();
  103. //
  104. // Method: GetID()
  105. //
  106. // Purpose: Gets the ID of a camera.
  107. //
  108. // Parameters: [out] std::string& cameraID The ID of the camera
  109. //
  110. // Returns:
  111. // - VmbErrorSuccess: If no error
  112. //
  113. // This information remains static throughout the object's lifetime
  114. //
  115. VmbErrorType GetID( std::string &cameraID ) const;
  116. //
  117. // Method: GetName()
  118. //
  119. // Purpose: Gets the name of a camera.
  120. //
  121. // Parameters: [out] std::string& name The name of the camera
  122. //
  123. // Returns:
  124. // - VmbErrorSuccess: If no error
  125. //
  126. // This information remains static throughout the object's lifetime
  127. //
  128. VmbErrorType GetName( std::string &name ) const;
  129. //
  130. // Method: GetModel()
  131. //
  132. // Purpose: Gets the model name of a camera.
  133. //
  134. // Parameters: [out] std::string& model The model name of the camera
  135. //
  136. // Returns:
  137. // - VmbErrorSuccess: If no error
  138. //
  139. // This information remains static throughout the object's lifetime
  140. //
  141. VmbErrorType GetModel( std::string &model ) const;
  142. //
  143. // Method: GetSerialNumber()
  144. //
  145. // Purpose: Gets the serial number of a camera.
  146. //
  147. // Parameters: [out] std::string& serialNumber The serial number of the camera
  148. //
  149. // Returns:
  150. // - VmbErrorSuccess: If no error
  151. //
  152. // This information remains static throughout the object's lifetime
  153. //
  154. VmbErrorType GetSerialNumber( std::string &serialNumber ) const;
  155. //
  156. // Method: GetInterfaceID()
  157. //
  158. // Purpose: Gets the interface ID of a camera.
  159. //
  160. // Parameters: [out] std::string& interfaceID The interface ID of the camera
  161. //
  162. // Returns:
  163. // - VmbErrorSuccess: If no error
  164. //
  165. // This information remains static throughout the object's lifetime
  166. //
  167. VmbErrorType GetInterfaceID( std::string &interfaceID ) const;
  168. //
  169. // Method: GetInterfaceType()
  170. //
  171. // Purpose: Gets the type of the interface the camera is connected to. And therefore the type of the camera itself.
  172. //
  173. // Parameters: [out] VmbInterfaceType& interfaceType The interface type of the camera
  174. //
  175. // Returns:
  176. // - VmbErrorSuccess: If no error
  177. //
  178. IMEXPORT VmbErrorType GetInterfaceType( VmbInterfaceType &interfaceType ) const;
  179. //
  180. // Method: GetPermittedAccess()
  181. //
  182. // Purpose: Gets the access modes of a camera.
  183. //
  184. // Parameters: [out] VmbAccessModeType& permittedAccess The possible access modes of the camera
  185. //
  186. // Returns:
  187. // - VmbErrorSuccess: If no error
  188. //
  189. IMEXPORT VmbErrorType GetPermittedAccess( VmbAccessModeType &permittedAccess ) const;
  190. //
  191. // Method: ReadRegisters()
  192. //
  193. // Purpose: Reads one or more registers consecutively. The number of registers to read is determined by the number of provided addresses.
  194. //
  195. // Parameters: [in ] const Uint64Vector& addresses A list of register addresses
  196. // [out] Uint64Vector& buffer The returned data as vector
  197. //
  198. // Returns:
  199. // - VmbErrorSuccess: If all requested registers have been read
  200. // - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
  201. // - VmbErrorIncomplete: If at least one, but not all registers have been read. See overload ReadRegisters( const Uint64Vector&, Uint64Vector&, VmbUint32_t& ).
  202. //
  203. virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer ) const;
  204. //
  205. // Method: ReadRegisters()
  206. //
  207. // Purpose: Same as ReadRegisters( const Uint64Vector&, Uint64Vector& ), but returns the number of successful read operations in case of an error.
  208. //
  209. // Parameters: [in ] const Uint64Vector& addresses A list of register addresses
  210. // [out] Uint64Vector& buffer The returned data as vector
  211. // [out] VmbUint32_t& completedReads The number of successfully read registers
  212. //
  213. // Returns:
  214. // - VmbErrorSuccess: If all requested registers have been read
  215. // - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
  216. // - VmbErrorIncomplete: If at least one, but not all registers have been read.
  217. //
  218. virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer, VmbUint32_t &completedReads ) const;
  219. //
  220. // Method: WriteRegisters()
  221. //
  222. // Purpose: Writes one or more registers consecutively. The number of registers to write is determined by the number of provided addresses.
  223. //
  224. // Parameters: [in] const Uint64Vector& addresses A list of register addresses
  225. // [in] const Uint64Vector& buffer The data to write as vector
  226. //
  227. // Returns:
  228. // - VmbErrorSuccess: If all requested registers have been written
  229. // - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
  230. // - VmbErrorIncomplete: If at least one, but not all registers have been written. See overload WriteRegisters( const Uint64Vector&, const Uint64Vector&, VmbUint32_t& ).
  231. //
  232. virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer );
  233. //
  234. // Method: WriteRegisters()
  235. //
  236. // Purpose: Same as WriteRegisters( const Uint64Vector&, const Uint64Vector& ), but returns the number of successful write operations in case of an error.
  237. //
  238. // Parameters: [in ] const Uint64Vector& addresses A list of register addresses
  239. // [in ] const Uint64Vector& buffer The data to write as vector
  240. // [out] VmbUint32_t& completedWrites The number of successfully read registers
  241. //
  242. // Returns:
  243. // - VmbErrorSuccess: If all requested registers have been written
  244. // - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
  245. // - VmbErrorIncomplete: If at least one, but not all registers have been written.
  246. //
  247. virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer, VmbUint32_t &completedWrites );
  248. //
  249. // Method: ReadMemory()
  250. //
  251. // Purpose: Reads a block of memory. The number of bytes to read is determined by the size of the provided buffer.
  252. //
  253. // Parameters: [in ] const VmbUint64_t& address The address to read from
  254. // [out] UcharVector& buffer The returned data as vector
  255. //
  256. // Returns:
  257. // - VmbErrorSuccess: If all requested bytes have been read
  258. // - VmbErrorBadParameter: Vector "buffer" is empty.
  259. // - VmbErrorIncomplete: If at least one, but not all bytes have been read. See overload ReadMemory( const VmbUint64_t&, UcharVector&, VmbUint32_t& ).
  260. //
  261. virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer ) const;
  262. //
  263. // Method: ReadMemory()
  264. //
  265. // Purpose: Same as ReadMemory( const Uint64Vector&, UcharVector& ), but returns the number of bytes successfully read in case of an error VmbErrorIncomplete.
  266. //
  267. // Parameters: [in] const VmbUint64_t& address The address to read from
  268. // [out] UcharVector& buffer The returned data as vector
  269. // [out] VmbUint32_t& completeReads The number of successfully read bytes
  270. //
  271. // Returns:
  272. // - VmbErrorSuccess: If all requested bytes have been read
  273. // - VmbErrorBadParameter: Vector "buffer" is empty.
  274. // - VmbErrorIncomplete: If at least one, but not all bytes have been read.
  275. //
  276. virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer, VmbUint32_t &completeReads ) const;
  277. //
  278. // Method: WriteMemory()
  279. //
  280. // Purpose: Writes a block of memory. The number of bytes to write is determined by the size of the provided buffer.
  281. //
  282. // Parameters: [in] const VmbUint64_t& address The address to write to
  283. // [in] const UcharVector& buffer The data to write as vector
  284. //
  285. // Returns:
  286. // - VmbErrorSuccess: If all requested bytes have been written
  287. // - VmbErrorBadParameter: Vector "buffer" is empty.
  288. // - VmbErrorIncomplete: If at least one, but not all bytes have been written. See overload WriteMemory( const VmbUint64_t&, const UcharVector&, VmbUint32_t& ).
  289. //
  290. virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer );
  291. //
  292. // Method: WriteMemory()
  293. //
  294. // Purpose: Same as WriteMemory( const Uint64Vector&, const UcharVector& ), but returns the number of bytes successfully written in case of an error VmbErrorIncomplete.
  295. //
  296. // Parameters: [in] const VmbUint64_t& address The address to write to
  297. // [in] const UcharVector& buffer The data to write as vector
  298. // [out] VmbUint32_t& sizeComplete The number of successfully written bytes
  299. //
  300. // Returns:
  301. // - VmbErrorSuccess: If all requested bytes have been written
  302. // - VmbErrorBadParameter: Vector "buffer" is empty.
  303. // - VmbErrorIncomplete: If at least one, but not all bytes have been written.
  304. //
  305. virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer, VmbUint32_t &sizeComplete );
  306. //
  307. // Method: AcquireSingleImage()
  308. //
  309. // Purpose: Gets one image synchronously.
  310. //
  311. // Parameters: [out] FramePtr& pFrame The frame that gets filled
  312. // [in ] VmbUint32_t timeout The time to wait until the frame got filled
  313. // [in ] FrameAllocationMode allocationMode The frame allocation mode
  314. //
  315. // Returns:
  316. // - VmbErrorSuccess: If no error
  317. // - VmbErrorBadParameter: "pFrame" is NULL.
  318. // - VmbErrorTimeout: Call timed out
  319. //
  320. IMEXPORT VmbErrorType AcquireSingleImage( FramePtr &pFrame, VmbUint32_t timeout, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
  321. //
  322. // Method: AcquireMultipleImages()
  323. //
  324. // Purpose: Gets a certain number of images synchronously.
  325. //
  326. // Parameters: [out] FramePtrVector& frames The frames that get filled
  327. // [in ] VmbUint32_t timeout The time to wait until one frame got filled
  328. // [in ] FrameAllocationMode allocationMode The frame allocation mode
  329. //
  330. // Details: The size of the frame vector determines the number of frames to use.
  331. //
  332. // Returns:
  333. // - VmbErrorSuccess: If no error
  334. // - VmbErrorInternalFault: Filling all the frames was not successful.
  335. // - VmbErrorBadParameter: Vector "frames" is empty.
  336. //
  337. VmbErrorType AcquireMultipleImages( FramePtrVector &frames, VmbUint32_t timeout, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
  338. //
  339. // Method: AcquireMultipleImages()
  340. //
  341. // Purpose: Same as AcquireMultipleImages(FramePtrVector&, VmbUint32_t), but returns the number of frames that were filled completely.
  342. //
  343. // Parameters: [out] FramePtrVector& frames The frames that get filled
  344. // [in ] VmbUint32_t timeout The time to wait until one frame got filled
  345. // [out] VmbUint32_t& numFramesCompleted The number of frames that were filled completely
  346. // [in ] FrameAllocationMode allocationMode The frame allocation mode
  347. //
  348. // Details: The size of the frame vector determines the number of frames to use.
  349. // On return, "numFramesCompleted" holds the number of frames actually filled.
  350. //
  351. // Returns:
  352. // - VmbErrorSuccess: If no error
  353. // - VmbErrorBadParameter: Vector "frames" is empty.
  354. //
  355. VmbErrorType AcquireMultipleImages( FramePtrVector &frames, VmbUint32_t timeout, VmbUint32_t &numFramesCompleted, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
  356. //
  357. // Method: StartContinuousImageAcquisition()
  358. //
  359. // Purpose: Starts streaming and allocates the needed frames
  360. //
  361. // Parameters: [in ] int bufferCount The number of frames to use
  362. // [out] const IFrameObserverPtr& pObserver The observer to use on arrival of new frames
  363. // [in] FrameAllocationMode allocationMode The frame allocation mode
  364. //
  365. // Returns:
  366. //
  367. // - VmbErrorSuccess: If no error
  368. // - VmbErrorDeviceNotOpen: The camera has not been opened before
  369. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  370. // - VmbErrorBadHandle: The given handle is not valid
  371. // - VmbErrorInvalidAccess: Operation is invalid with the current access mode
  372. //
  373. IMEXPORT VmbErrorType StartContinuousImageAcquisition( int bufferCount, const IFrameObserverPtr &pObserver, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
  374. //
  375. // Method: StopContinuousImageAcquisition()
  376. //
  377. // Purpose: Stops streaming and deallocates the needed frames
  378. //
  379. IMEXPORT VmbErrorType StopContinuousImageAcquisition();
  380. //
  381. // Method: AnnounceFrame()
  382. //
  383. // Purpose: Announces a frame to the API that may be queued for frame capturing later.
  384. //
  385. // Parameters:
  386. //
  387. // [in ] const FramePtr& pFrame Shared pointer to a frame to announce
  388. //
  389. // Returns:
  390. //
  391. // - VmbErrorSuccess: If no error
  392. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  393. // - VmbErrorBadHandle: The given handle is not valid
  394. // - VmbErrorBadParameter: "pFrame" is NULL.
  395. // - VmbErrorStructSize: The given struct size is not valid for this version of the API
  396. //
  397. // Details: Allows some preparation for frames like DMA preparation depending on the transport layer.
  398. // The order in which the frames are announced is not taken in consideration by the API.
  399. //
  400. IMEXPORT VmbErrorType AnnounceFrame( const FramePtr &pFrame );
  401. //
  402. // Method: RevokeFrame()
  403. //
  404. // Purpose: Revoke a frame from the API.
  405. //
  406. // Parameters:
  407. //
  408. // [in ] const FramePtr& pFrame Shared pointer to a frame that is to be removed from the list of announced frames
  409. //
  410. // Returns:
  411. //
  412. // - VmbErrorSuccess: If no error
  413. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  414. // - VmbErrorBadHandle: The given frame pointer is not valid
  415. // - VmbErrorBadParameter: "pFrame" is NULL.
  416. // - VmbErrorStructSize: The given struct size is not valid for this version of the API
  417. //
  418. // Details: The referenced frame is removed from the pool of frames for capturing images.
  419. //
  420. IMEXPORT VmbErrorType RevokeFrame( const FramePtr &pFrame );
  421. //
  422. // Method: RevokeAllFrames()
  423. //
  424. // Purpose: Revoke all frames assigned to this certain camera.
  425. //
  426. // Returns:
  427. //
  428. // - VmbErrorSuccess: If no error
  429. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  430. // - VmbErrorBadHandle: The given handle is not valid
  431. //
  432. IMEXPORT VmbErrorType RevokeAllFrames();
  433. //
  434. // Method: QueueFrame()
  435. //
  436. // Purpose: Queues a frame that may be filled during frame capturing.
  437. //
  438. // Parameters:
  439. //
  440. // [in ] const FramePtr& pFrame A shared pointer to a frame
  441. //
  442. // Returns:
  443. //
  444. // - VmbErrorSuccess: If no error
  445. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  446. // - VmbErrorBadHandle: The given frame is not valid
  447. // - VmbErrorBadParameter: "pFrame" is NULL.
  448. // - VmbErrorStructSize: The given struct size is not valid for this version of the API
  449. // - VmbErrorInvalidCall: StopContinuousImageAcquisition is currently running in another thread
  450. //
  451. // Details: The given frame is put into a queue that will be filled sequentially.
  452. // The order in which the frames are filled is determined by the order in which they are queued.
  453. // If the frame was announced with AnnounceFrame() before, the application
  454. // has to ensure that the frame is also revoked by calling RevokeFrame() or RevokeAll()
  455. // when cleaning up.
  456. //
  457. IMEXPORT VmbErrorType QueueFrame( const FramePtr &pFrame );
  458. //
  459. // Method: FlushQueue()
  460. //
  461. // Purpose: Flushes the capture queue.
  462. //
  463. // Returns:
  464. //
  465. // - VmbErrorSuccess: If no error
  466. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  467. // - VmbErrorBadHandle: The given handle is not valid
  468. //
  469. // Details: All the currently queued frames will be returned to the user, leaving no frames in the input queue.
  470. // After this call, no frame notification will occur until frames are queued again.
  471. //
  472. IMEXPORT VmbErrorType FlushQueue();
  473. //
  474. // Method: StartCapture()
  475. //
  476. // Purpose: Prepare the API for incoming frames from this camera.
  477. //
  478. // Returns:
  479. //
  480. // - VmbErrorSuccess: If no error
  481. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  482. // - VmbErrorBadHandle: The given handle is not valid
  483. // - VmbErrorDeviceNotOpen: Camera was not opened for usage
  484. // - VmbErrorInvalidAccess: Operation is invalid with the current access mode
  485. //
  486. IMEXPORT VmbErrorType StartCapture();
  487. //
  488. // Method: EndCapture()
  489. //
  490. // Purpose: Stop the API from being able to receive frames from this camera.
  491. //
  492. // Returns:
  493. //
  494. // - VmbErrorSuccess: If no error
  495. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  496. // - VmbErrorBadHandle: The given handle is not valid
  497. //
  498. // Details: Consequences of VmbCaptureEnd():
  499. // - The frame queue is flushed
  500. // - The frame callback will not be called any more
  501. //
  502. IMEXPORT VmbErrorType EndCapture();
  503. //
  504. // Method: SaveCameraSettings()
  505. //
  506. // Purpose: Saves the current camera setup to an XML file
  507. //
  508. // Parameters:
  509. //
  510. // [in ] std::string pStrFileName xml file name
  511. // [in ] VmbFeaturePersistSettings_t* pSettings pointer to settings struct
  512. //
  513. // Returns:
  514. //
  515. // - VmbErrorSuccess: If no error
  516. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  517. // - VmbErrorBadHandle: The given handle is not valid
  518. // - VmbErrorInternalFault: When something unexpected happens in VimbaC function
  519. // - VmbErrorOther: Every other failure in load/save settings implementation class
  520. //
  521. VmbErrorType SaveCameraSettings( std::string fileName, VmbFeaturePersistSettings_t *pSettings = 0 ) const;
  522. //
  523. // Method: LoadCameraSettings()
  524. //
  525. // Purpose: Loads the current camera setup from an XML file into the camera
  526. //
  527. // Parameters:
  528. //
  529. // [in] std::string pStrFileName xml file name
  530. // [in] VmbFeaturePersistSettings_t* pSettings pointer to settings struct
  531. //
  532. // Returns:
  533. //
  534. // - VmbErrorSuccess: If no error
  535. // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
  536. // - VmbErrorBadHandle: The given handle is not valid
  537. // - VmbErrorInternalFault: When something unexpected happens in VimbaC function
  538. // - VmbErrorOther: Every other failure in load/save settings implementation class
  539. //
  540. VmbErrorType LoadCameraSettings( std::string fileName, VmbFeaturePersistSettings_t *pSettings = 0 ) const;
  541. //
  542. // Method: LoadSaveSettingsSetup()
  543. //
  544. // Purpose: Sets Load/Save settings behaviour (alternative to settings struct)
  545. //
  546. // Parameters:
  547. //
  548. // [in] VmbFeaturePersist_t persistType determines which feature shall be considered during load/save settings
  549. // [in] VmbUint32_t maxIterations determines how many 'tries' during loading feature values shall be performed
  550. // [in] VmbUint32_t loggingLevel determines level of detail for load/save settings logging
  551. //
  552. IMEXPORT void LoadSaveSettingsSetup( VmbFeaturePersist_t persistType, VmbUint32_t maxIterations, VmbUint32_t loggingLevel );
  553. private:
  554. // Default ctor
  555. Camera();
  556. // Copy ctor
  557. Camera ( const Camera& );
  558. // Assignment operator
  559. Camera& operator=( const Camera& );
  560. struct Impl;
  561. Impl *m_pImpl;
  562. // Array functions to pass data across DLL boundaries
  563. IMEXPORT VmbErrorType GetID( char * const pID, VmbUint32_t &length ) const;
  564. IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
  565. IMEXPORT VmbErrorType GetModel( char * const pModelName, VmbUint32_t &length ) const;
  566. IMEXPORT VmbErrorType GetSerialNumber( char * const pSerial, VmbUint32_t &length ) const;
  567. IMEXPORT VmbErrorType GetInterfaceID( char * const pInterfaceID, VmbUint32_t &length ) const;
  568. IMEXPORT VmbErrorType AcquireMultipleImages( FramePtr *pFrames, VmbUint32_t size, VmbUint32_t nTimeout, VmbUint32_t *pNumFramesCompleted, FrameAllocationMode allocationMode );
  569. IMEXPORT virtual VmbErrorType ReadRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t addressSize, VmbUint64_t *pDataArray, VmbUint32_t *pCompletedReads ) const;
  570. IMEXPORT virtual VmbErrorType WriteRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t addressSize, const VmbUint64_t *pDataArray, VmbUint32_t *pCompletedWrites );
  571. IMEXPORT virtual VmbErrorType ReadMemory( VmbUint64_t address, VmbUchar_t *pBuffer, VmbUint32_t bufferSize, VmbUint32_t *pSizeComplete ) const;
  572. IMEXPORT virtual VmbErrorType WriteMemory( VmbUint64_t address, const VmbUchar_t *pBuffer, VmbUint32_t bufferSize, VmbUint32_t *pSizeComplete );
  573. IMEXPORT VmbErrorType SaveCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const;
  574. IMEXPORT VmbErrorType LoadCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const;
  575. VmbFeaturePersist_t m_persistType;
  576. VmbUint32_t m_maxIterations;
  577. VmbUint32_t m_loggingLevel;
  578. };
  579. #include <VimbaCPP/Include/Camera.hpp>
  580. }} // namespace AVT::VmbAPI
  581. #endif