BaslerGigEInstantCamera.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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 Pylon GigE specific instant camera class.
  10. */
  11. #ifndef INCLUDED_BASLERGIGEINSTANTCAMERA_H_7164973
  12. #define INCLUDED_BASLERGIGEINSTANTCAMERA_H_7164973
  13. #include <pylon/gige/_BaslerGigECameraParams.h>
  14. namespace Basler_GigECameraParams = Basler_GigECamera;
  15. #include <pylon/gige/_GigEStreamParams.h>
  16. #include <pylon/gige/_GigEEventParams.h>
  17. #include <pylon/gige/_GigETLParams.h>
  18. #include <pylon/gige/BaslerGigEDeviceInfo.h>
  19. #include <pylon/gige/PylonGigEDevice.h>
  20. #include <pylon/gige/BaslerGigEConfigurationEventHandler.h>
  21. #include <pylon/gige/BaslerGigEImageEventHandler.h>
  22. #include <pylon/gige/BaslerGigECameraEventHandler.h>
  23. #include <pylon/gige/BaslerGigEGrabResultPtr.h>
  24. #include <pylon/private/DeviceSpecificInstantCamera.h>
  25. #include <pylon/DeviceClass.h>
  26. #include <pylon/NodeMapProxy.h>
  27. namespace Pylon
  28. {
  29. /** \addtogroup Pylon_InstantCameraApiGigE
  30. * @{
  31. */
  32. class CBaslerGigEInstantCamera;
  33. /// Lists all the types used by the GigE device specific instant camera class.
  34. struct CBaslerGigEInstantCameraTraits
  35. {
  36. /// The type of the final camera class.
  37. typedef CBaslerGigEInstantCamera InstantCamera_t;
  38. /// \copybrief Basler_GigECamera::CGigECamera_Params
  39. typedef Basler_GigECamera::CGigECamera_Params CameraParams_t;
  40. /// \copybrief Pylon::IPylonGigEDevice
  41. typedef IPylonGigEDevice IPylonDevice_t;
  42. /// \copybrief Pylon::CBaslerGigEDeviceInfo
  43. typedef Pylon::CBaslerGigEDeviceInfo DeviceInfo_t;
  44. /// \copybrief Pylon::CPylonGigETLParams
  45. typedef CNodeMapProxyT<Basler_GigETLParams::CGigETLParams_Params> TlParams_t;
  46. /// The parameters of the GigE streamgrabber.
  47. typedef CNodeMapProxyT<Basler_GigEStreamParams::CGigEStreamParams_Params> StreamGrabberParams_t;
  48. /// The parameters of the GigE eventgrabber.
  49. typedef CNodeMapProxyT<Basler_GigEEventParams::CGigEEventParams_Params> EventGrabberParams_t;
  50. /// The GigE specific configuration event handler class.
  51. typedef CBaslerGigEConfigurationEventHandler ConfigurationEventHandler_t;
  52. /// The GigE specific image event handler class.
  53. typedef CBaslerGigEImageEventHandler ImageEventHandler_t;
  54. /// The GigE specific camera event handler class.
  55. typedef CBaslerGigECameraEventHandler CameraEventHandler_t;
  56. /// The GigE specific grab result data.
  57. typedef CBaslerGigEGrabResultData GrabResultData_t;
  58. /// The GigE specific grab result smart pointer.
  59. typedef CBaslerGigEGrabResultPtr GrabResultPtr_t;
  60. //! Can be used to check whether the DeviceClass() can be used for enumeration.
  61. static bool HasSpecificDeviceClass()
  62. {
  63. return true;
  64. }
  65. //! The name of this device class. Use this one for enumeration.
  66. static String_t DeviceClass()
  67. {
  68. return BaslerGigEDeviceClass;
  69. }
  70. };
  71. /*!
  72. \class CBaslerGigEInstantCamera
  73. \brief Extends the CInstantCamera by GigE specific parameter interface classes and GigE specific methods.
  74. \deprecated This class is deprecated in pylon 6.0. Please consider using CBaslerUniversalInstantCamera instead.
  75. */
  76. PYLON_6_0_DEPRECATED( "Use CBaslerUniversalInstantCamera" )
  77. class CBaslerGigEInstantCamera : public CDeviceSpecificInstantCameraT<CBaslerGigEInstantCameraTraits>
  78. {
  79. public:
  80. /*!
  81. \copybrief CInstantCamera::CInstantCamera()
  82. \copydetails CInstantCamera::CInstantCamera
  83. */
  84. CBaslerGigEInstantCamera()
  85. {
  86. }
  87. /*!
  88. \copybrief CInstantCamera::CInstantCamera( IPylonDevice* , ECleanup )
  89. \copydetails CInstantCamera::CInstantCamera( IPylonDevice* , ECleanup )
  90. */
  91. CBaslerGigEInstantCamera( IPylonDevice* pDevice, ECleanup cleanupProcedure = Cleanup_Delete )
  92. : CDeviceSpecificInstantCameraT<CBaslerGigEInstantCameraTraits>( pDevice, cleanupProcedure )
  93. {
  94. }
  95. /*!
  96. \copybrief CInstantCamera::~CInstantCamera
  97. \copydetails CInstantCamera::~CInstantCamera
  98. */
  99. ~CBaslerGigEInstantCamera()
  100. {
  101. Attach( NULL );
  102. InternalShutdownEventHandlers();
  103. }
  104. /*!
  105. \brief Enables/disables use of persistent IP address and DHCP usage of the attached %Pylon Device.
  106. See Pylon::IPylonGigEDevice::ChangeIpConfiguration()
  107. \pre
  108. <ul>
  109. <li> A %Pylon Device is attached.
  110. <li> The %Pylon Device is open.
  111. </ul>
  112. \error
  113. The Instant Camera object is still valid after error.
  114. \threading
  115. This method is synchronized using the lock provided by GetLock().
  116. */
  117. void ChangeIpConfiguration( bool EnablePersistentIp, bool EnableDhcp )
  118. {
  119. AutoLock lock( CInstantCamera::GetLock() );
  120. GetDevice()->ChangeIpConfiguration( EnablePersistentIp, EnableDhcp );
  121. }
  122. /*!
  123. \brief Reads the persistent IP address from the attached %Pylon Device.
  124. See Pylon::IPylonGigEDevice::GetPersistentIpAddress()
  125. \pre
  126. <ul>
  127. <li> A %Pylon Device is attached.
  128. <li> The %Pylon Device is open.
  129. </ul>
  130. \error
  131. The Instant Camera object is still valid after error.
  132. \threading
  133. This method is synchronized using the lock provided by GetLock().
  134. */
  135. void GetPersistentIpAddress( String_t& IpAddress, String_t& SubnetMask, String_t& DefaultGateway )
  136. {
  137. AutoLock lock( CInstantCamera::GetLock() );
  138. GetDevice()->GetPersistentIpAddress( IpAddress, SubnetMask, DefaultGateway );
  139. }
  140. /*!
  141. \brief Writes a persistent IP address to the attached %Pylon Device.
  142. See Pylon::IPylonGigEDevice::SetPersistentIpAddress()
  143. \pre
  144. <ul>
  145. <li> A %Pylon Device is attached.
  146. <li> The %Pylon Device is open.
  147. </ul>
  148. \error
  149. The Instant Camera object is still valid after error.
  150. \threading
  151. This method is synchronized using the lock provided by GetLock().
  152. */
  153. void SetPersistentIpAddress( const String_t& IpAddress,
  154. const String_t& SubnetMask,
  155. const String_t& DefaultGateway )
  156. {
  157. AutoLock lock( CInstantCamera::GetLock() );
  158. GetDevice()->SetPersistentIpAddress( IpAddress, SubnetMask, DefaultGateway );
  159. }
  160. protected:
  161. //Get the pointer for the GigE device.
  162. virtual IPylonGigEDevice* GetDevice()
  163. {
  164. IPylonDevice* pDevice = CInstantCamera::GetDevice();
  165. IPylonGigEDevice* pGigEDevice = dynamic_cast<IPylonGigEDevice*>(pDevice);
  166. // Check whether device type matches camera type.
  167. if (!pGigEDevice)
  168. {
  169. throw LOGICAL_ERROR_EXCEPTION( "The attached pylon device type must be a GigE device." );
  170. }
  171. return pGigEDevice;
  172. }
  173. //Create device specific grab result data. Is subject to change without notice.
  174. virtual CGrabResultData* CreateDeviceSpecificGrabResultData()
  175. {
  176. return new GrabResultData_t();
  177. }
  178. };
  179. /**
  180. * @}
  181. */
  182. } // namespace Pylon
  183. #endif /* INCLUDED_BASLERGIGEINSTANTCAMERA_H_7164973 */