InstantCamera.h 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301
  1. //------------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2010-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: Andreas Gau
  6. //------------------------------------------------------------------------------
  7. /*!
  8. \file
  9. \brief Contains a camera class establishing convenient access to a camera device.
  10. */
  11. #ifndef INCLUDED_INSTANTCAMERA_H_08725703
  12. #define INCLUDED_INSTANTCAMERA_H_08725703
  13. #include <pylon/Platform.h>
  14. #ifdef _MSC_VER
  15. # pragma pack(push, PYLON_PACKING)
  16. #endif /* _MSC_VER */
  17. #include <pylon/stdinclude.h>
  18. #include <pylon/PylonBase.h>
  19. #include <pylon/ImageEventHandler.h>
  20. #include <pylon/ConfigurationEventHandler.h>
  21. #include <pylon/CameraEventHandler.h>
  22. #include <pylon/BufferFactory.h>
  23. #include <pylon/GrabResultPtr.h>
  24. #include <pylon/DeviceInfo.h>
  25. #include <pylon/WaitObject.h>
  26. #include <pylon/Device.h>
  27. #include <pylon/SfncVersion.h>
  28. namespace Pylon
  29. {
  30. /// Internal use only.
  31. class IInstantCameraExtensions;
  32. }
  33. #ifdef _MSC_VER
  34. #pragma warning( push )
  35. #pragma warning( disable : 4275 ) // Class needs to have a dll interface to be used by clients of the class.
  36. #endif
  37. #include <pylon/_InstantCameraParams.h>
  38. namespace Pylon
  39. {
  40. /** \addtogroup Pylon_InstantCameraApiGeneric
  41. * @{
  42. */
  43. /// Lists the possible grab strategies.
  44. enum EGrabStrategy
  45. {
  46. GrabStrategy_OneByOne, //!< The images are processed in the order of their arrival. This is the default grab strategy.
  47. GrabStrategy_LatestImageOnly, //!< Only the latest image is kept in the output queue, all other grabbed images are skipped.
  48. //!< If no image is in the output queue when retrieving an image with \c CInstantCamera::RetrieveResult(),
  49. //!< the processing waits for the upcoming image.
  50. GrabStrategy_LatestImages, //!< This strategy can be used to grab images while keeping only the latest images. If the application does not
  51. //!< retrieve all images in time, all other grabbed images are skipped. The CInstantCamera::OutputQueueSize parameter can be used to
  52. //!< control how many images can be queued in the output queue. When setting the output queue size to 1, this strategy is equivalent to
  53. //!< GrabStrategy_LatestImageOnly grab strategy. When setting the output queue size to CInstantCamera::MaxNumBuffer,
  54. //!< this strategy is equivalent to GrabStrategy_OneByOne.
  55. GrabStrategy_UpcomingImage //!< The input buffer queue is kept empty. This prevents grabbing.
  56. //!< However, when retrieving an image with a call to the \c CInstantCamera::RetrieveResult() method
  57. //!< a buffer is queued into the input queue and then the call waits for the upcoming image.
  58. //!< The buffer is removed from the queue on timeout.
  59. //!< Hence after the call to the \c CInstantCamera::RetrieveResult() method the input buffer queue is empty again.
  60. //!< The upcoming image grab strategy cannot be used together with USB or GenTL-based camera devices. See the advanced topics section of
  61. //!< the pylon Programmer's Guide for more information.
  62. };
  63. /// Defines who deletes a passed object if it is not needed anymore.
  64. enum ECleanup
  65. {
  66. Cleanup_None, //!< The caller is responsible for deleting the passed object. The object needs to be detached or deregistered before deletion.
  67. Cleanup_Delete //!< The passed object is deleted if it is not needed anymore.
  68. };
  69. /// Defines the use of an additional grab loop thread.
  70. enum EGrabLoop
  71. {
  72. GrabLoop_ProvidedByInstantCamera, //!< The grab loop thread is provided by the Instant Camera. It calls RetrieveResult() in a loop. Grabbed images are processed by registered image event handlers. The grab loop thread is started when the grab starts.
  73. GrabLoop_ProvidedByUser //!< The user code calls RetrieveResult() in a loop to process grabbed images and camera events.
  74. };
  75. /// Defines how to register an item.
  76. enum ERegistrationMode
  77. {
  78. RegistrationMode_Append, //!< The item is appended to the list of registered items.
  79. RegistrationMode_ReplaceAll //!< The item replaces all other registered items.
  80. };
  81. /// Defines how to register a camera event handler.
  82. enum ECameraEventAvailability
  83. {
  84. CameraEventAvailability_Mandatory, //!< The camera event must be provided by the camera, otherwise an exception is thrown.
  85. CameraEventAvailability_Optional //!< The camera event handler is not used if the camera does not support the camera event.
  86. };
  87. /// Defines how to handle a timeout for a method.
  88. enum ETimeoutHandling
  89. {
  90. TimeoutHandling_Return, //!< The method returns on timeout. What data is returned can be found in the documentation of the method.
  91. TimeoutHandling_ThrowException //!< An exception is thrown on timeout.
  92. };
  93. /*!
  94. \class CInstantCamera
  95. \brief Provides convenient access to a camera device.
  96. <ul>
  97. <li> Establishes a single access point for accessing camera functionality.
  98. <li> The class can be used off the shelf without any parameters. The camera uses a default configuration for the camera device. This can be overridden.
  99. <li> Handles %Pylon device lifetime. This can be overridden.
  100. <li> Handles opening and closing of a %Pylon device automatically.
  101. <li> Handles chunk data parsing automatically returning the chunk data in the grab result.
  102. <li> Handles event grabbing automatically providing a convenient interface for event callbacks. This can be overridden.
  103. <li> Handles physical camera device removal.
  104. <li> Handles the creation, reuse, and destruction of buffers.
  105. <li> The grabbing can be done in the context of the caller or by using an additional grab loop thread.
  106. <li> The Instant Camera class is extensible using derivation or by registering event handler objects.
  107. </ul>
  108. */
  109. class PYLONBASE_API CInstantCamera : public Basler_InstantCameraParams::CInstantCameraParams_Params
  110. {
  111. public:
  112. //Creation and life time------------------------------------------------
  113. /*!
  114. \brief Creates an Instant Camera object with no attached %Pylon device.
  115. \error
  116. Does not throw C++ exceptions.
  117. */
  118. CInstantCamera();
  119. /*!
  120. \brief Creates an Instant Camera object and calls Attach().
  121. See Attach() for more information.
  122. \param[in] pDevice The %Pylon device to attach.
  123. \param[in] cleanupProcedure If cleanupProcedure equals Cleanup_Delete, the %Pylon device is destroyed when the Instant Camera object is destroyed.
  124. \error
  125. May throw an exception if the passed %Pylon device is open.
  126. Does not throw C++ exceptions if the passed %Pylon device is closed or NULL.
  127. */
  128. CInstantCamera( IPylonDevice* pDevice, ECleanup cleanupProcedure = Cleanup_Delete );
  129. /*!
  130. \brief Destroys an Instant Camera object.
  131. Calls Attach( NULL) for destroying or removing a %Pylon device depending on the passed cleanup procedure.
  132. \error
  133. Does not throw C++ exceptions.
  134. */
  135. virtual ~CInstantCamera();
  136. /*!
  137. \brief Attaches a %Pylon device to the Instant Camera.
  138. \param[in] pDevice The %Pylon device to attach.
  139. \param[in] cleanupProcedure If cleanupProcedure equals Cleanup_Delete, the %Pylon device is destroyed when the Instant Camera object is destroyed.
  140. <ul>
  141. <li> If a %Pylon device is currently attached, it is destroyed (DestroyDevice()) or removed (DetachDevice()) depending on the previously set cleanup procedure value.
  142. <li> If the pDevice parameter is NULL, nothing more is done.
  143. <li> The OnAttach configuration event is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  144. <li> The new %Pylon device is attached.
  145. <li> The instant camera migration mode setting is applied to the %Pylon device transport layer node map.
  146. <li> If the passed %Pylon device is open, callbacks for camera events are registered at the camera node map. (This may fail)
  147. <li> If the passed %Pylon device is open, a device removal call back is registered. (This may fail)
  148. <li> If the passed %Pylon device is open, access modifiers (see IPylonDevice::Open()) are carried over as camera parameters.
  149. <li> The OnAttached configuration event is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  150. </ul>
  151. \post
  152. <ul>
  153. <li>If the passed pointer to the %Pylon device is NULL, the Instant Camera object is in the "no device attached" state.
  154. <li>If the passed pointer to the %Pylon device is not NULL, the passed %Pylon device is attached.
  155. <li>If the set cleanup procedure equals Cleanup_Delete, the %Pylon device is destroyed when the Instant Camera object is destroyed or a new device is attached.
  156. <li>If the passed %Pylon device is open and the registration of callbacks fails, the Instant Camera object is in the "no device attached" state.
  157. <li>The opened-by-user flag is set, preventing closing of the %Pylon device on StopGrabbing() when the attached %Pylon device is already open.
  158. </ul>
  159. \error
  160. May throw an exception if the passed %Pylon device is open.
  161. Does not throw C++ exceptions if the passed %Pylon device is closed or NULL.
  162. \threading
  163. This method is synchronized using the lock provided by GetLock().
  164. */
  165. virtual void Attach( IPylonDevice* pDevice, ECleanup cleanupProcedure = Cleanup_Delete );
  166. /*!
  167. \brief Returns the %Pylon device attached state of the Instant Camera object.
  168. \return True if a %Pylon device is attached.
  169. \error
  170. Does not throw C++ exceptions.
  171. \threading
  172. This method is synchronized using the lock provided by GetLock().
  173. */
  174. virtual bool IsPylonDeviceAttached() const;
  175. /*!
  176. \brief Returns the connection state of the camera device.
  177. \attention Due to technical reasons, the IsCameraDeviceRemoved() property may not be updated immediately after the first error caused by a device removal occurs.
  178. The device removal is only detected while the Instant Camera and therefore the attached %Pylon device are open.
  179. The attached %Pylon device is not operable anymore if the camera device has been removed from the PC.
  180. After it is made sure that no access to the %Pylon device or any of its node maps is made anymore
  181. the %Pylon device should be destroyed using CInstantCamera::DeviceDestroy().
  182. The access to the %Pylon device can be protected using the lock provided by GetLock(), e.g. when accessing parameters.
  183. \return True if the camera device removal from the PC has been detected.
  184. \error
  185. Does not throw C++ exceptions.
  186. \threading
  187. This method is synchronized using the lock provided by GetLock().
  188. */
  189. virtual bool IsCameraDeviceRemoved() const;
  190. /*!
  191. \brief Returns the ownership of the attached %Pylon device.
  192. \return True if a %Pylon device is attached and the Instant Camera object has been given the ownership
  193. by passing the cleanup procedure Cleanup_Delete when calling Attach().
  194. \error
  195. Does not throw C++ exceptions.
  196. \threading
  197. This method is synchronized using the lock provided by GetLock().
  198. */
  199. virtual bool HasOwnership() const;
  200. /*!
  201. \brief Destroys the attached %Pylon device.
  202. \attention The node maps, e.g. the camera node map, of the attached %Pylon device must not be accessed anymore while destroying the %Pylon device.
  203. <ul>
  204. <li> If no %Pylon device is attached, nothing is done.
  205. <li> If the %Pylon device is open, it is closed by calling Close().
  206. <li> The configuration event OnDestroy is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  207. <li> The %Pylon device is destroyed even if the cleanup procedure Cleanup_None has been passed when calling Attach() before.
  208. <li> The configuration event OnDestroyed is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  209. </ul>
  210. \post No %Pylon device is attached.
  211. \error
  212. Does not throw C++ exceptions. Possible C++ exceptions are caught and ignored.
  213. \threading
  214. This method is synchronized using the lock provided by GetLock().
  215. */
  216. virtual void DestroyDevice();
  217. /*!
  218. \brief Detaches an attached %Pylon device.
  219. <ul>
  220. <li> If no %Pylon device is attached, nothing is done.
  221. <li> If a grab is in progress, it is stopped by calling StopGrabbing().
  222. <li> The configuration event OnDetach is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  223. <li> The %Pylon device is detached.
  224. <li> The configuration event OnDetached is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  225. </ul>
  226. \return The attached %Pylon device or NULL if nothing has been attached before.
  227. \post
  228. <ul>
  229. <li> No %Pylon device is attached.
  230. <li> The ownership of the %Pylon device goes to the caller who is responsible for destroying the %Pylon device.
  231. </ul>
  232. \error
  233. Does not throw C++ exceptions. Possible C++ exceptions are caught and ignored.
  234. \threading
  235. This method is synchronized using the lock provided by GetLock().
  236. */
  237. virtual IPylonDevice* DetachDevice();
  238. //Control opening and closing of the device-----------------------------
  239. /*!
  240. \brief Opens the attached %Pylon device.
  241. <ul>
  242. <li> Opened by user flag is set, preventing closing of the device on StopGrabbing().
  243. <li> If the %Pylon device is already open, nothing more is done.
  244. <li> The OnOpen configuration event is fired. The notification of event handlers stops when an event call triggers an exception.
  245. <li> The %Pylon device is opened and a connection to the camera device is established.
  246. <li> The instant camera migration mode setting is applied to the %Pylon device transport layer node map.
  247. <li> A device removal call back is registered at the %Pylon device.
  248. <li> Callbacks for camera events are registered at the camera node map.
  249. <li> The OnOpened configuration event is fired if the %Pylon device has been opened successfully. The notification of event handlers stops when an event call triggers an exception.
  250. </ul>
  251. \pre A %Pylon device is attached.
  252. \post
  253. <ul>
  254. <li> The %Pylon device is open and a connection to the camera device has been established.
  255. <li> Opened by user flag is set, preventing closing of the %Pylon device on StopGrabbing().
  256. </ul>
  257. \error
  258. The Instant Camera object is still valid after error.
  259. The %Pylon device open may throw.
  260. Configuration event calls may throw.
  261. Callback registrations may throw.
  262. The %Pylon device is closed with Close() if the OnOpened event call triggers an exception.
  263. \threading
  264. This method is synchronized using the lock provided by GetLock().
  265. */
  266. virtual void Open();
  267. /*!
  268. \brief Returns the open state of the attached %Pylon device object.
  269. \note This method still returns true if the camera device has been physically removed from the PC while the attached %Pylon device object is open.
  270. The %Pylon device object will not automatically close itself on device removal. It must be closed by calling CInstantCamera::Close().
  271. The IsCameraDeviceRemoved() method can be used to check if the connection to the camera device has been lost while the attached %Pylon device object is open.
  272. \error Does not throw C++ exceptions.
  273. \return Returns true if a %Pylon device is attached and it is open.
  274. \threading
  275. This method is synchronized using the lock provided by GetLock().
  276. */
  277. virtual bool IsOpen() const;
  278. /*!
  279. \brief Closes the attached %Pylon device.
  280. <ul>
  281. <li> If no %Pylon device is attached, nothing is done.
  282. <li> If the %Pylon device is already closed, nothing is done.
  283. <li> If a grab is in progress, it is stopped by calling StopGrabbing().
  284. <li> The configuration event OnClose is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  285. <li> The connection to the camera device is closed and the %Pylon device is closed.
  286. <li> The configuration event OnClosed is fired if the %Pylon device has been closed successfully. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  287. </ul>
  288. \post The connection to the camera device is closed and the %Pylon device is closed.
  289. \error
  290. Does not throw C++ exceptions. Possible C++ exceptions are caught and ignored.
  291. \threading
  292. This method is synchronized using the lock provided by GetLock().
  293. */
  294. virtual void Close();
  295. //Grab -----------------------------------------------------------------
  296. /*!
  297. \brief Starts the grabbing of images.
  298. <ul>
  299. <li> If a grab loop thread has been used in the last grab session, the grab loop thread context is joined with the caller's context.
  300. <li> If the %Pylon device is not already open, it is opened by calling Open().
  301. <li> The configuration event OnGrabStart is fired. The notification of event handlers stops when an event call triggers an exception.
  302. <li> Grab-specific parameters of the camera object are locked, e.g. MaxNumBuffers.
  303. <li> If the camera device parameter ChunkModeActive is enabled, the Instant Camera chunk parsing support is initialized.
  304. <li> If the Instant Camera parameter GrabCameraEvents is enabled, the Instant Camera event grabbing support is initialized.
  305. <li> The grabbing is started.
  306. <li> The AcquisitionStart command of the camera device is executed.
  307. <li> The configuration event OnGrabStarted is fired if the grab has been started successfully. The notification of event handlers stops when an event call triggers an exception.
  308. <li> If grabLoopType equals GrabLoop_ProvidedByInstantCamera, an additional grab loop thread is started calling RetrieveResult( GrabLoopThreadTimeout, grabResult) in a loop.
  309. </ul>
  310. \param[in] strategy The grab strategy. See Pylon::EGrabStrategy for more information
  311. \param[in] grabLoopType If grabLoopType equals GrabLoop_ProvidedByInstantCamera, an additional grab loop thread is used to run the grab loop.
  312. \pre
  313. <ul>
  314. <li> A %Pylon device is attached.
  315. <li> The stream grabber of the %Pylon device is closed.
  316. <li> The grabbing is stopped.
  317. <li> The attached %Pylon device supports grabbing.
  318. <li> Must not be called while holding the lock provided by GetLock() when using the grab loop thread.
  319. </ul>
  320. \post
  321. <ul>
  322. <li> The grabbing is started.
  323. <li> Grab-specific parameters of the camera object are locked, e.g. MaxNumBuffers.
  324. <li> If grabLoopType equals GrabLoop_ProvidedByInstantCamera, an additional grab loop thread is running that calls RetrieveResult( GrabLoopThreadTimeout, grabResult) in a loop. Images are processed by registered image event handlers.
  325. <li> Operating the stream grabber from outside the camera object will result in undefined behavior.
  326. </ul>
  327. \error
  328. The Instant Camera object is still valid after error. Open() may throw. Configuration event calls may throw. The grab implementation may throw.
  329. The grabbing is stopped with StopGrabbing() if the OnGrabStarted event call triggers an exception. Throws a C++ exception, if Upcoming Image grab strategy
  330. is used together with USB camera devices.
  331. \threading
  332. This method is synchronized using the lock provided by GetLock().
  333. */
  334. virtual void StartGrabbing( EGrabStrategy strategy = GrabStrategy_OneByOne, EGrabLoop grabLoopType = GrabLoop_ProvidedByUser );
  335. /*!
  336. \brief Starts the grabbing for a maximum number of images.
  337. Extends the StartGrabbing(EStrategy, EGrabLoop) by a number of images to grab. If the passed count of images has been reached, StopGrabbing is called
  338. automatically. The images are counted according to the grab strategy. Skipped images are not taken into account.
  339. The amount of allocated buffers is reduced to maxImages when grabbing fewer images
  340. than according to the value of the \link Pylon::CInstantCamera::MaxNumBuffer \c MaxNumBuffer \endlink parameter
  341. and the grab strategy is GrabStrategy_OneByOne.
  342. \param[in] maxImages The count of images to grab. This value must be larger than zero.
  343. \param[in] strategy The grab strategy. See Pylon::InstantCamera::EStrategy for more information.
  344. \param[in] grabLoopType If grabLoopType equals GrabLoop_ProvidedByInstantCamera, an additional grab loop thread is used to run the grab loop.
  345. \threading
  346. This method is synchronized using the lock provided by GetLock().
  347. */
  348. virtual void StartGrabbing( size_t maxImages, EGrabStrategy strategy = GrabStrategy_OneByOne, EGrabLoop grabLoopType = GrabLoop_ProvidedByUser );
  349. /*!
  350. \brief Retrieves a grab result according to the strategy, waits if it is not yet available
  351. <ul>
  352. <li> The content of the passed grab result is released.
  353. <li> If no %Pylon device is attached or the grabbing is not started, the method returns immediately "false".
  354. <li> Wait for a grab result if it is not yet available. The access to the camera is not locked during waiting. Camera events are handled.
  355. <li> Only if camera events are used: Incoming camera events are handled.
  356. <li> One grab result is retrieved per call according to the strategy applied.
  357. <li> Only if chunk mode is used: The chunk data parsing is performed. The grab result data is updated using chunk data.
  358. <li> The image event OnImagesSkipped is fired if grab results have been skipped according to the strategy. The notification of event handlers stops when an event call triggers an exception.
  359. <li> The image event OnImageGrabbed is fired if a grab result becomes available. The notification of event handlers stops when an event call triggers an exception.
  360. <li> Stops the grabbing by calling StopGrabbing() if the maximum number of images has been grabbed.
  361. </ul>
  362. It needs to be checked whether the grab represented by the grab result has been successful, see CGrabResultData::GrabSucceeded().
  363. \param[in] timeoutMs A timeout value in ms for waiting for a grab result, or the INFINITE value.
  364. \param[out] grabResult Receives the grab result.
  365. \param[in] timeoutHandling If timeoutHandling equals TimeoutHandling_ThrowException, a timeout exception is thrown on timeout.
  366. \return True if the call successfully retrieved a grab result, false otherwise.
  367. \pre
  368. <ul>
  369. <li> There is no other thread waiting for a result. This will be the case when the Instant Camera grab loop thread is used.
  370. </ul>
  371. \post
  372. <ul>
  373. <li> If a grab result has been retrieved, one image is removed from the output queue and is returned in the grabResult parameter.
  374. <li> If no grab result has been retrieved, an empty grab result is returned in the grabResult parameter.
  375. <li> If the maximum number of images has been grabbed, the grabbing is stopped.
  376. <li> If camera event handling is enabled and camera events were received, at least one or more camera event messages have been processed.
  377. </ul>
  378. \error
  379. The Instant Camera object is still valid after error. The grabbing is stopped if an exception is thrown.
  380. \threading
  381. This method is synchronized using the lock provided by GetLock() while not waiting.
  382. */
  383. virtual bool RetrieveResult( unsigned int timeoutMs, CGrabResultPtr& grabResult, ETimeoutHandling timeoutHandling = TimeoutHandling_ThrowException );
  384. /*!
  385. \brief Stops the grabbing of images.
  386. <ul>
  387. <li> Nothing is done if the Instant Camera is not currently grabbing.
  388. <li> The configuration event OnGrabStop is fired. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  389. <li> The AcquisitionStop command of the camera device is executed.
  390. <li> The grabbing is stopped.
  391. <li> All buffer queues of the Instant Camera are cleared.
  392. <li> The OnGrabStopped configuration event is fired if the grab has been stopped successfully. Possible C++ exceptions from event calls are caught and ignored. All event handlers are notified.
  393. <li> If the Instant Camera has been opened by StartGrabbing, it is closed by calling Close().
  394. <li> Grab-specific parameters of the camera object are unlocked, e.g. MaxNumBuffers.
  395. </ul>
  396. \post
  397. <ul>
  398. <li> The grabbing is stopped.
  399. <li> If the %Pylon device has been opened by StartGrabbing and no other camera object service requires it to be open, it is closed.
  400. <li> Grab specific parameters of the camera object are unlocked, e.g. MaxNumBuffers.
  401. </ul>
  402. \error
  403. Does not throw C++ exceptions. Possible C++ exceptions are caught and ignored.
  404. \threading
  405. This method is synchronized using the lock provided by GetLock().
  406. */
  407. virtual void StopGrabbing();
  408. /*!
  409. \brief Returns state of grabbing.
  410. The camera object is grabbing after a successful call to StartGrabbing() until StopGrabbing() is called.
  411. \return Returns true if still grabbing.
  412. \error
  413. Does not throw C++ exceptions.
  414. \threading
  415. This method is synchronized using the lock provided by GetLock().
  416. */
  417. virtual bool IsGrabbing() const;
  418. /*!
  419. \brief Grabs one image.
  420. The following code shows a simplified version of what is done (happy path):
  421. \code
  422. //grab one image
  423. StartGrabbing( 1, GrabStrategy_OneByOne, GrabLoop_ProvidedByUser);
  424. //grab is stopped automatically due to maxImages = 1
  425. return RetrieveResult( timeoutMs, grabResult, timeoutHandling) && grabResult->GrabSucceeded();
  426. \endcode
  427. GrabOne() can be used to together with the CAcquireSingleFrameConfiguration.
  428. \note Using GrabOne is more efficient if the %Pylon device is already open, otherwise the %Pylon device is opened and closed for each call.
  429. \note Grabbing single images using Software Trigger (CSoftwareTriggerConfiguration) is recommended if you want to maximize frame rate.
  430. This is because the overhead per grabbed image is reduced compared to Single Frame Acquisition.
  431. The grabbing can be started using StartGrabbing().
  432. Images are grabbed using the WaitForFrameTriggerReady(), ExecuteSoftwareTrigger() and RetrieveResult() methods instead of using GrabOne.
  433. The grab can be stopped using StopGrabbing() when done.
  434. \param[in] timeoutMs A timeout value in ms for waiting for a grab result, or the INFINITE value.
  435. \param[out] grabResult Receives the grab result.
  436. \param[in] timeoutHandling If timeoutHandling equals TimeoutHandling_ThrowException, a timeout exception is thrown on timeout.
  437. \return Returns true if the call successfully retrieved a grab result and the grab succeeded (CGrabResultData::GrabSucceeded()).
  438. \pre Must meet the preconditions of start grabbing.
  439. \post Meets the postconditions of stop grabbing.
  440. \error
  441. The Instant Camera object is still valid after error. See StartGrabbing(), RetrieveResult(), and StopGrabbing() .
  442. In the case of exceptions after StartGrabbing() the grabbing is stopped using StopGrabbing().
  443. */
  444. virtual bool GrabOne( unsigned int timeoutMs, CGrabResultPtr& grabResult, ETimeoutHandling timeoutHandling = TimeoutHandling_ThrowException );
  445. /*!
  446. \brief Deprecated: This method has been deprecated. Use the NumQueuedBuffers parameter instead.
  447. \return The number of buffers that are queued for grabbing.
  448. */
  449. virtual size_t GetQueuedBufferCount();
  450. /*!
  451. \brief Provides access to a wait object indicating available grab results.
  452. \return A wait object indicating available grab results.
  453. \error
  454. Does not throw C++ exceptions.
  455. \threading
  456. This method is synchronized using the lock provided by GetLock().
  457. */
  458. virtual const WaitObject& GetGrabResultWaitObject();
  459. /*!
  460. \brief Provides access to a wait object indicating that the grabbing has stopped.
  461. \return A wait object indicating that the grabbing has stopped.
  462. \error
  463. Does not throw C++ exceptions.
  464. \threading
  465. This method is synchronized using the lock provided by GetLock().
  466. */
  467. virtual const WaitObject& GetGrabStopWaitObject();
  468. /*!
  469. \brief Provides access to a wait object indicating available camera events.
  470. This wait object is %Pylon device specific and changes when a new %Pylon device is attached to
  471. the camera.
  472. \return A wait object indicating available camera events.
  473. \pre
  474. <ul>
  475. <li> A %Pylon device is attached.
  476. <li> The %Pylon device is open.
  477. </ul>
  478. \error
  479. The Instant Camera object is still valid after error.
  480. \threading
  481. This method is synchronized using the lock provided by GetLock().
  482. */
  483. virtual const WaitObject& GetCameraEventWaitObject();
  484. //Event handling--------------------------------------------------------
  485. /*!
  486. \brief Adds a configurator to the list of registered configurator objects.
  487. <ul>
  488. <li> If mode equals RegistrationMode_ReplaceAll, the list of registered configurators is cleared.
  489. <li> If pointer \c pConfigurator is not NULL, it is appended to the list of configurators.
  490. </ul>
  491. \param[in] pConfigurator The receiver of configuration events.
  492. \param[in] mode Indicates how to register the new configurator.
  493. \param[in] cleanupProcedure If cleanupProcedure equals Cleanup_Delete, the passed event handler is deleted when no longer needed.
  494. \post The configurator is registered and called on configuration events.
  495. \error
  496. Does not throw C++ exceptions, except when memory allocation fails.
  497. \threading
  498. This method is synchronized using the lock provided by GetLock().
  499. */
  500. virtual void RegisterConfiguration( CConfigurationEventHandler* pConfigurator, ERegistrationMode mode, ECleanup cleanupProcedure );
  501. /*!
  502. \brief Removes a configurator from the list of registered configurator objects.
  503. If the configurator is not found, nothing is done.
  504. \param[in] configurator The registered receiver of configuration events.
  505. \return True if successful
  506. \post
  507. <ul>
  508. <li> The configurator is deregistered.
  509. <li> If the configuration has been registered by passing a pointer and the cleanup procedure is Cleanup_Delete, the event handler is deleted.
  510. </ul>
  511. \error
  512. Does not throw C++ exceptions.
  513. \threading
  514. This method is synchronized using the lock provided by GetLock().
  515. */
  516. virtual bool DeregisterConfiguration( CConfigurationEventHandler* configurator );
  517. /*!
  518. \brief Adds an image event handler to the list of registered image event handler objects.
  519. <ul>
  520. <li> If mode equals RegistrationMode_ReplaceAll, the list of registered image event handlers is cleared.
  521. <li> If pointer \c pImageEventHandler is not NULL, it is appended to the list of image event handlers.
  522. </ul>
  523. \param[in] pImageEventHandler The receiver of image events.
  524. \param[in] mode Indicates how to register the new imageEventHandler.
  525. \param[in] cleanupProcedure If cleanupProcedure equals Cleanup_Delete, the passed event handler is deleted when no longer needed.
  526. \post The imageEventHandler is registered and called on image related events.
  527. \error
  528. Does not throw C++ exceptions, except when memory allocation fails.
  529. \threading
  530. This method is synchronized using the internal image event handler registry lock.
  531. */
  532. virtual void RegisterImageEventHandler( CImageEventHandler* pImageEventHandler, ERegistrationMode mode, ECleanup cleanupProcedure );
  533. /*!
  534. \brief Removes an image event handler from the list of registered image event handler objects.
  535. If the image event handler is not found, nothing is done.
  536. \param[in] imageEventHandler The registered receiver of configuration events.
  537. \return True if successful
  538. \post
  539. <ul>
  540. <li> The imageEventHandler is deregistered.
  541. <li> If the image event handler has been registered by passing a pointer and the cleanup procedure is Cleanup_Delete, the event handler is deleted.
  542. </ul>
  543. \error
  544. Does not throw C++ exceptions.
  545. \threading
  546. This method is synchronized using the internal image event handler registry lock.
  547. */
  548. virtual bool DeregisterImageEventHandler( CImageEventHandler* imageEventHandler );
  549. /*!
  550. \brief Adds an camera event handler to the list of registered camera event handler objects.
  551. <ul>
  552. <li> If mode equals RegistrationMode_ReplaceAll, the list of registered camera event handlers is cleared.
  553. <li> If the pointer \c pCameraEventHandler is not NULL, it is appended to the list of camera event handlers.
  554. </ul>
  555. \param[in] pCameraEventHandler The receiver of camera events.
  556. \param[in] nodeName The name of the event data node updated on camera event, e.g. "ExposureEndEventTimestamp" for exposure end event.
  557. \param[in] userProvidedId This ID is passed as a parameter in CCameraEventHandler::OnCameraEvent and can be used to distinguish between different events.
  558. It is recommended to create an own application specific enum and use it's values as IDs.
  559. \param[in] mode Indicates how to register the new cameraEventHandler.
  560. \param[in] cleanupProcedure If cleanupProcedure equals Cleanup_Delete, the passed event handler is deleted when no longer needed.
  561. \param[in] availability If availability equals CameraEventAvailability_Mandatory, the camera must support the data node specified by node name.
  562. If not, an exception is thrown when the Instant Camera is open, the Instant Camera is opened, or an open %Pylon device is attached.
  563. Internally, a GenApi node call back is registered for the node identified by \c nodeName.
  564. This callback triggers a call to the \c CCameraEventHandler::OnCameraEvent() method.
  565. That's why a Camera Event Handler can be registered for any node of the camera node map to get informed about changes.
  566. \post The cameraEventHandler is registered and called on camera events.
  567. \error
  568. Throws an exception if the availability is set to CameraEventAvailability_Mandatory and the node with the name \c nodeName is not available in the camera node map (see GetNodeMap()).
  569. Throws an exception fail if the node callback registration fails.
  570. The event handler is not registered when an C++ exception is thrown.
  571. \threading
  572. This method is synchronized using the camera event handler lock. If the camera is open, the lock provided by GetLock() and the camera
  573. node map lock are also used for synchronization.
  574. */
  575. virtual void RegisterCameraEventHandler(
  576. CCameraEventHandler* pCameraEventHandler,
  577. const String_t& nodeName,
  578. intptr_t userProvidedId,
  579. ERegistrationMode mode,
  580. ECleanup cleanupProcedure,
  581. ECameraEventAvailability availability = CameraEventAvailability_Mandatory );
  582. /*!
  583. \brief Removes a camera event handler from the list of registered camera event handler objects.
  584. If the camera event handler is not found, nothing is done.
  585. \param[in] cameraEventHandler The registered receiver of camera events.
  586. \param[in] nodeName The name of the event data node updated on camera event, e.g. "ExposureEndEventTimestamp" for exposure end event.
  587. \return True if successful
  588. \post
  589. <ul>
  590. <li> The cameraEventHandler is deregistered.
  591. <li> If the camera event handler has been registered by passing a pointer and the cleanup procedure is Cleanup_Delete, the event handler is deleted.
  592. </ul>
  593. \error
  594. Does not throw C++ exceptions.
  595. \threading
  596. This method is synchronized using the camera event handler lock. If the camera is open, the camera node map lock
  597. is also used for synchronization.
  598. */
  599. virtual bool DeregisterCameraEventHandler( CCameraEventHandler* cameraEventHandler, const String_t& nodeName );
  600. //Additional features---------------------------------------------------
  601. /*!
  602. \brief Actively waits until the the camera is ready to accept a frame trigger.
  603. The implementation selects 'FrameTriggerWait' for the 'AcquisitionStatusSelector'
  604. and waits until the 'AcquisitionStatus' is true.
  605. If the above mentioned nodes are not available and the 'SoftwareTrigger' node is readable,
  606. the implementation waits for SoftwareTrigger.IsDone().
  607. The WaitForFrameTriggerReady method does not work for A600 Firewire cameras.
  608. \param[in] timeoutMs The timeout in ms for active waiting.
  609. \param[in] timeoutHandling If timeoutHandling equals TimeoutHandling_ThrowException, a timeout exception is thrown on timeout.
  610. \return True if the camera can execute a frame trigger.
  611. \pre The 'AcquisitionStatusSelector' node is writable and the 'AcquisitionStatus' node is readable or the 'SoftwareTrigger' node is readable.
  612. This depends on the used camera model.
  613. \error
  614. Accessing the camera registers may fail.
  615. \threading
  616. This method is synchronized using the lock provided by GetLock().
  617. */
  618. virtual bool WaitForFrameTriggerReady( unsigned int timeoutMs, ETimeoutHandling timeoutHandling = TimeoutHandling_ThrowException );
  619. /*!
  620. \brief Checks to see whether the camera device can be queried whether it is ready to accept the next frame trigger.
  621. If 'FrameTriggerWait' can be selected for 'AcquisitionStatusSelector' and 'AcquisitionStatus' is readable, the
  622. camera device can be queried whether it is ready to accept the next frame trigger.
  623. If the nodes mentioned above are not available and the 'SoftwareTrigger' node is readable, the
  624. camera device can be queried whether it is ready to accept the next frame trigger.
  625. \note If a camera device can't be queried whether it is ready to accept the next frame trigger, the camera device is
  626. ready to accept the next trigger after the last image triggered has been grabbed, e.g. after you have retrieved
  627. the last image triggered using RetrieveResult(). Camera devices that can be queried whether they are ready to accept the
  628. next frame trigger, may not be ready for the next frame trigger after the last image triggered has been grabbed.
  629. \return Returns true if the camera is open and the camera device can be queried whether it is ready to accept the next frame trigger.
  630. \post The 'AcquisitionStatusSelector' is set to 'FrameTriggerWait' if writable.
  631. \error
  632. Accessing the camera registers may fail.
  633. \threading
  634. This method is synchronized using the lock provided by GetLock().
  635. */
  636. virtual bool CanWaitForFrameTriggerReady() const;
  637. /*!
  638. \brief Executes the software trigger command.
  639. The camera needs to be configured for software trigger mode.
  640. Additionally, the camera needs to be ready to accept triggers.
  641. When triggering a frame this can be checked using the WaitForFrameTriggerReady() method;
  642. \note The application has to make sure that the correct trigger is selected
  643. before calling ExecuteSoftwareTrigger().
  644. This can be done via the camera's TriggerSelector node.
  645. The \c Pylon::CSoftwareTriggerConfiguration
  646. selects the correct trigger when the Instant Camera is opened.
  647. \pre
  648. <ul>
  649. <li> The grabbing is started.
  650. <li> The camera device supports software trigger.
  651. <li> The software trigger is available. This depends on the configuration of the camera device.
  652. </ul>
  653. \error
  654. Accessing the camera registers may fail. Throws an exception on timeout if \c timeoutHandling is TimeoutHandling_ThrowException.
  655. \threading
  656. This method is synchronized using the lock provided by GetLock().
  657. */
  658. virtual void ExecuteSoftwareTrigger();
  659. /*!
  660. \brief Sets a context that is attached to each grab result of the camera object on RetrieveResult().
  661. This is useful when handling multiple cameras. It has nothing in common with the context passed to the stream grabber when queuing a buffer.
  662. \error
  663. Does not throw C++ exceptions.
  664. \threading
  665. This method is synchronized using the lock provided by GetLock().
  666. */
  667. virtual void SetCameraContext( intptr_t context );
  668. /*!
  669. \brief Returns the context that is attached to each grab result of the camera object
  670. \error
  671. Does not throw C++ exceptions.
  672. \threading
  673. This method is synchronized using the lock provided by GetLock().
  674. */
  675. virtual intptr_t GetCameraContext() const;
  676. /*!
  677. \brief Provides access to the device info object of the attached %Pylon device or an empty one.
  678. \return The info object of the attached %Pylon device or an empty one.
  679. \error
  680. Does not throw C++ exceptions.
  681. \threading
  682. This method is synchronized using the lock provided by GetLock().
  683. */
  684. virtual const CDeviceInfo& GetDeviceInfo() const;
  685. /*!
  686. \brief Provides access to the node map of the camera device.
  687. The %Pylon device must be opened before reading ore writing any parameters of the camera device.
  688. This can be done using the Open() method of the Instant Camera class.
  689. \return Reference to the node map of the camera device.
  690. \pre A %Pylon device is attached.
  691. \error
  692. The Instant Camera object is still valid after error.
  693. \threading
  694. This method is synchronized using the lock provided by GetLock().
  695. */
  696. virtual GenApi::INodeMap& GetNodeMap();
  697. /*!
  698. \brief Provides access to the transport layer node map of the attached %Pylon device.
  699. \return Reference to the transport layer node map of the attached %Pylon device
  700. or the reference to the empty node map if a transport layer node map is not supported.
  701. The GenApi::INodeMap::GetNumNodes() method can be used to check whether the node map is empty.
  702. \pre A %Pylon device is attached.
  703. \error
  704. The Instant Camera object is still valid after error.
  705. \threading
  706. This method is synchronized using the lock provided by GetLock().
  707. */
  708. virtual GenApi::INodeMap& GetTLNodeMap();
  709. /*!
  710. \brief Provides access to the stream grabber node map of the attached %Pylon device.
  711. \return Reference to the stream grabber node map of the attached %Pylon device
  712. or the reference to the empty node map if grabbing is not supported.
  713. The GenApi::INodeMap::GetNumNodes() method can be used to check whether the node map is empty.
  714. \pre
  715. <ul>
  716. <li> A %Pylon device is attached.
  717. <li> The %Pylon device is open.
  718. </ul>
  719. \error
  720. The Instant Camera object is still valid after error.
  721. \threading
  722. This method is synchronized using the lock provided by GetLock().
  723. */
  724. virtual GenApi::INodeMap& GetStreamGrabberNodeMap();
  725. /*!
  726. \brief Provides access to the event grabber node map of the attached %Pylon device.
  727. \return Reference to the event grabber node map of the attached %Pylon device
  728. or a reference to the empty node map if event grabbing is not supported.
  729. The GenApi::INodeMap::GetNumNodes() method can be used to check whether the node map is empty.
  730. \pre
  731. <ul>
  732. <li> A %Pylon device is attached.
  733. <li> The %Pylon device is open.
  734. </ul>
  735. \error
  736. The Instant Camera object is still valid after error.
  737. \threading
  738. This method is synchronized using the lock provided by GetLock().
  739. */
  740. virtual GenApi::INodeMap& GetEventGrabberNodeMap();
  741. /*!
  742. \brief Provides access to the node map of the Instant Camera object.
  743. The node map of the camera device is made available by the GetNodeMap() method.
  744. \return Reference to the node map of the Instant Camera object.
  745. \error
  746. Does not throw C++ exceptions.
  747. \threading
  748. This method is synchronized using the lock provided by GetLock().
  749. */
  750. virtual GenApi::INodeMap& GetInstantCameraNodeMap();
  751. /*!
  752. \brief Sets an alternative buffer factory that is used for buffer allocation.
  753. This use of this method is optional and intended for advanced use cases only.
  754. If NULL is passed as buffer factory then the default buffer factory is used.
  755. Buffers are allocated when StartGrabbing is called.
  756. A buffer factory must not be deleted while it is attached to the camera object
  757. and it must not be deleted until the last buffer is freed. To free all buffers
  758. the grab needs to be stopped and all grab results must be released or destroyed.
  759. \param[in] pFactory A pointer to a buffer factory.
  760. \param[in] cleanupProcedure If ownership is cleanupProcedure Cleanup_Delete, the passed factory is destroyed when no longer needed.
  761. \threading
  762. This method is synchronized using the lock provided by GetLock().
  763. */
  764. virtual void SetBufferFactory( IBufferFactory* pFactory, ECleanup cleanupProcedure = Cleanup_Delete );
  765. /*!
  766. \brief Returns true if an IEEE 1394 %Pylon device is attached to the Instant Camera object.
  767. This method is provided for convenience only. The device type can also be determined as shown in the following example.
  768. \code
  769. #include <pylon/DeviceClass.h>
  770. ...
  771. if (camera.GetDeviceInfo().GetDeviceClass() == Basler1394DeviceClass)
  772. {
  773. ...
  774. }
  775. \endcode
  776. \threading
  777. This method is synchronized using the lock provided by GetLock().
  778. */
  779. virtual bool Is1394() const;
  780. /*!
  781. \brief Returns true if a GigE %Pylon device is attached to the Instant Camera object.
  782. This method is provided for convenience only. The device type can also be determined as shown in the following example.
  783. \code
  784. #include <pylon/DeviceClass.h>
  785. ...
  786. if (camera.GetDeviceInfo().GetDeviceClass() == BaslerGigEDeviceClass)
  787. {
  788. ...
  789. }
  790. \endcode
  791. \threading
  792. This method is synchronized using the lock provided by GetLock().
  793. */
  794. virtual bool IsGigE() const;
  795. /*!
  796. \brief Returns true if a USB %Pylon device is attached to the Instant Camera object.
  797. This method is provided for convenience only. The device type can also be determined as shown in the following example.
  798. \code
  799. #include <pylon/DeviceClass.h>
  800. ...
  801. if (camera.GetDeviceInfo().GetDeviceClass() == BaslerUsbDeviceClass)
  802. {
  803. ...
  804. }
  805. \endcode
  806. \threading
  807. This method is synchronized using the lock provided by GetLock().
  808. */
  809. virtual bool IsUsb() const;
  810. /*!
  811. \brief Returns true if a Camera Link %Pylon device is attached to the Instant Camera object.
  812. This method is provided for convenience only. The device type can also be determined as shown in the following example.
  813. \code
  814. #include <pylon/DeviceClass.h>
  815. ...
  816. if (camera.GetDeviceInfo().GetDeviceClass() == BaslerCameraLinkDeviceClass)
  817. {
  818. ...
  819. }
  820. \endcode
  821. \threading
  822. This method is synchronized using the lock provided by GetLock().
  823. */
  824. virtual bool IsCameraLink() const;
  825. /*!
  826. \brief Returns true if a CoaXPress GenTL device is attached to the Instant Camera object.
  827. This method is provided for convenience only.
  828. \threading
  829. This method is synchronized using the lock provided by GetLock().
  830. */
  831. virtual bool IsCxp() const;
  832. /*!
  833. \brief Returns the SFNC version read from the camera node map.
  834. The SFNC version is read from the camera node map using the integer nodes
  835. DeviceSFNCVersionMajor, DeviceSFNCVersionMinor, and DeviceSFNCVersionSubMinor.
  836. \return The SFNC version used by the camera device. The returned SFNC version is 0.0.0 (Pylon::Sfnc_VersionUndefined)
  837. if no SFNC version information is provided by the camera device.
  838. \pre A %Pylon device is attached.
  839. \error
  840. The Instant Camera object is still valid after error.
  841. \threading
  842. This method is synchronized using the lock provided by GetLock().
  843. */
  844. VersionInfo GetSfncVersion() const;
  845. //Types used by camera--------------------------------------------------
  846. /// The type of the camera class
  847. typedef CInstantCamera InstantCamera_t;
  848. /// \copybrief Pylon::IPylonDevice
  849. typedef IPylonDevice IPylonDevice_t;
  850. /// \copybrief Pylon::CDeviceInfo
  851. typedef Pylon::CDeviceInfo DeviceInfo_t;
  852. /// The generic configuration event handler class
  853. typedef CConfigurationEventHandler ConfigurationEventHandler_t;
  854. /// The generic image event handler class
  855. typedef CImageEventHandler ImageEventHandler_t;
  856. /// The generic image event handler class
  857. typedef CCameraEventHandler CameraEventHandler_t;
  858. /// The generic grab result data
  859. typedef CGrabResultData GrabResultData_t;
  860. /// The generic grab result smart pointer
  861. typedef CGrabResultPtr GrabResultPtr_t;
  862. protected:
  863. /*!
  864. \brief Provides access to the attached %Pylon device.
  865. \return Pointer to the attached %Pylon device.
  866. \pre A %Pylon device is attached.
  867. \error
  868. The Instant Camera object is still valid after error.
  869. \threading
  870. This method is synchronized using the lock provided by GetLock().
  871. */
  872. virtual IPylonDevice* GetDevice();
  873. /*!
  874. \brief Provides access to the lock used for synchronizing the access to the camera.
  875. This lock can be used when extending the Instant Camera class.
  876. Example:
  877. \code
  878. class CMyInstantCamera : public CInstantCamera
  879. {
  880. // Method extending the Instant Camera class
  881. void Foo()
  882. {
  883. // Scoped Lock.
  884. AutoLock lock( CInstantCamera::GetLock());
  885. //...
  886. }
  887. };
  888. \endcode
  889. \error
  890. Does not throw C++ exceptions.
  891. */
  892. CLock& GetLock();
  893. /*
  894. \brief Returns a reference to the empty node map.
  895. The empty node map can be used by device specific camera classes.
  896. The pointer to the empty node map does not change during the lifetime of the camera object.
  897. \return Reference to the empty node map.
  898. \error
  899. Does not throw C++ exceptions.
  900. \threading
  901. This method is synchronized using the lock provided by GetLock().
  902. */
  903. GenApi::INodeMap& GetEmptyNodeMap();
  904. // Internal use only. Subject to change without notice.
  905. void InternalRegisterConfiguration( CConfigurationEventHandler*, ERegistrationMode, ECleanup, const long* );
  906. // Internal use only. Subject to change without notice.
  907. void InternalRegisterImageEventHandler( CImageEventHandler*, ERegistrationMode, ECleanup, const long* );
  908. // Internal use only. Subject to change without notice.
  909. void InternalRegisterCameraEventHandler( CCameraEventHandler*, const String_t&, intptr_t, ERegistrationMode, ECleanup, ECameraEventAvailability, const long* );
  910. // Internal use only. Subject to change without notice.
  911. bool InternalDeregisterConfiguration( const long* );
  912. // Internal use only. Subject to change without notice.
  913. bool InternalDeregisterImageEventHandler( const long* );
  914. // Internal use only. Subject to change without notice.
  915. bool InternalDeregisterCameraEventHandler( const long*, const String_t& );
  916. // Internal use only. Subject to change without notice.
  917. void InternalShutdownEventHandlers();
  918. public:
  919. // Internal use only. Subject to change without notice.
  920. IInstantCameraExtensions& GetExtensionInterface();
  921. private:
  922. // The camera object can not be copied.
  923. CInstantCamera( const CInstantCamera& );
  924. // The camera object can not be copied.
  925. void operator = ( const CInstantCamera& );
  926. class CInstantCameraImpl;
  927. CInstantCameraImpl* m_pImpl;
  928. protected:
  929. // Internal use only. Subject to change without notice.
  930. friend class CGrabResultDataFactory;
  931. // Internal use only. Subject to change without notice.
  932. virtual CGrabResultData* CreateDeviceSpecificGrabResultData();
  933. private:
  934. // Internal use only. Subject to change without notice.
  935. CGrabResultData* CreateGrabResultData();
  936. public:
  937. /*!
  938. \brief Returns true if a BCON %Pylon device is attached to the Instant Camera object.
  939. This method is provided for convenience only. The device type can also be determined as shown in the following example.
  940. \code
  941. #include <pylon/DeviceClass.h>
  942. ...
  943. if (camera.GetDeviceInfo().GetDeviceClass() == BaslerBconDeviceClass)
  944. {
  945. ...
  946. }
  947. \endcode
  948. \threading
  949. This method is synchronized using the lock provided by GetLock().
  950. */
  951. virtual bool IsBcon() const;
  952. };
  953. /**
  954. * @}
  955. */
  956. }
  957. #ifdef _MSC_VER
  958. #pragma warning( pop )
  959. #endif
  960. #ifdef _MSC_VER
  961. # pragma pack(pop)
  962. #endif /* _MSC_VER */
  963. #endif /* INCLUDED_INSTANTCAMERA_H_08725703 */