gigecamera.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef __DAHUA_GENICAM_IGIGECAMERA_H__
  2. #define __DAHUA_GENICAM_IGIGECAMERA_H__
  3. #include "GenICam/Defs.h"
  4. #include "GenICam/Camera.h"
  5. #include "Infra/String.h"
  6. #include "Memory/SharedPtr.h"
  7. GENICAM_NAMESPACE_BEGIN
  8. class IGigECamera;
  9. typedef Memory::TSharedPtr<IGigECamera> IGigECameraPtr;
  10. /// \~chinese
  11. /// \brief 相机对象接口类
  12. /// \defgroup GigECamera GigE相机对象操作接口
  13. /// \~english
  14. /// \brief camera object interface class
  15. /// \defgroup GigECamera API for GigEVision Cameras Only
  16. /// @{
  17. /// \~chinese
  18. /// \brief GigE相机对象
  19. /// \~english
  20. /// \brief GigE camera object
  21. class GENICAM_API IGigECamera
  22. {
  23. public:
  24. enum ECameraAccessPermission
  25. {
  26. accessPermissionOpen = 0, ///< \~chinese GigE相机没有被连接 ///< \~english The GigE vision device isn't connected to any application.
  27. accessPermissionExclusive, ///< \~chinese 独占访问权限 ///< \~english Exclusive Access Permission
  28. accessPermissionControl, ///< \~chinese 非独占可读访问权限 ///< \~english Non-Exclusive Readbale Access Permission
  29. accessPermissionControlWithSwitchover, ///< \~chinese Control access with switchover enabled. ///< \~english Control access with switchover enabled.
  30. accessPermissionUnknown = 254, ///< \~chinese 无法确定 ///< \~english Value not known; indeterminate.
  31. accessPermissionUndefined ///< \~chinese 未定义访问权限 ///< \~english Undefined Access Permission
  32. };
  33. protected:
  34. /// \~chinese
  35. /// \brief 析构函数
  36. /// \~english
  37. /// \brief destruct function
  38. virtual ~IGigECamera(){}
  39. public:
  40. /// \~chinese
  41. /// \brief GigE相机对象获取接口,同一个cameraPtr对应的是同一个GigE相机对象
  42. /// \param [in] cameraPtr GigE类型的相机智能指针对象,如果传入了其它非GigE相机类型,该接口返回空指针,表示无效
  43. /// \~english
  44. /// \brief GigE GigE camera object access interface, same cameraPtr is correspond to same GigE camera object
  45. /// \brief [in] cameraPtr Smart pointer object of GigE camera, if the cameraPtr point to a camera which is not GigE camera, the interface return NULL which means it is invalid
  46. static IGigECameraPtr getInstance(const ICameraPtr &cameraPtr);
  47. /// \~chinese
  48. /// \brief 获取相机的ipAddress
  49. /// \return 返回ipAddress 相机的IP地址
  50. /// \~english
  51. /// \brief get ipAddress of camera
  52. /// \return success:return ipAddress of camera, fail:return empty string
  53. virtual Infra::CString getIpAddress() const = 0;
  54. /// \~chinese
  55. /// \brief 返回相机的子网掩码
  56. /// \return 返回subnetMask 相机的子网掩码
  57. /// \~english
  58. /// \brief get subnetMask of camera
  59. /// \return success:return camera's subnetMask, fail:return empty string
  60. virtual Infra::CString getSubnetMask() const = 0;
  61. /// \~chinese
  62. /// \brief 返回相机的网关
  63. /// \return 返回 gateway 相机的网关
  64. /// \~english
  65. /// \brief get gateway of camera
  66. /// \return success:return camera's gateway, fail:return empty string
  67. virtual Infra::CString getGateway() const = 0;
  68. /// \~chinese
  69. /// \brief 获取相机的 macAddress
  70. /// \return 返回macAddress 相机的Mac地址
  71. /// \~english
  72. /// \brief get macAddress of camera
  73. /// \return success:return camera's macAddress, fail:return empty string
  74. virtual Infra::CString getMacAddress() const = 0;
  75. /// \~chinese
  76. /// \brief 修改设备IP
  77. ///1、调用该函数时如果newSubnetMask和newGateway都设置了有效值,则以此有效值为准;
  78. ///2、调用该函数时如果newSubnetMask和newGateway都设置了NULL,则内部实现时用它所连接网卡的子网掩码和网关代替
  79. ///3、调用该函数时如果newSubnetMask和newGateway两者中其中一个为NULL,另一个非NULL,则返回失败
  80. /// 该接口只针对通过网卡接入的设备,对于其余设备,调用此接口无意义
  81. /// \param [in] newIpAddress 新的IP地址信息
  82. /// \param [in] newSubnetMask 新的掩码信息
  83. /// \param [in] newGateway 新的网关信息
  84. /// \return 是否成功
  85. /// \~english
  86. /// \brief modify device IP
  87. /// \brief 1、When callback this function, if the values of newSubnetMask and newGateway are both valid then we consider the value is correct
  88. /// \brief 2、When callback this function, if the values of newSubnetMask and newGateway are both NULL, then these values will be replaced by the subnetmask and gateway of NIC which this camera connect to.
  89. /// \brief 3、When callback this function, if there is one value of newSubnetMask or newGateway is NULL and the other one is not NULL, then return failed
  90. /// \brief this interface only serve the devices which is connected to NIC. As for other devices, callback this function won't work and return failed
  91. /// \param [in] newIpAddress new IP address
  92. /// \param [in] newSubnetMask new SubnetMask
  93. /// \param [in] newGateway new Gateway
  94. /// \retval true modify IP failed
  95. /// \retval false modify IP success
  96. virtual bool forceIpAddress (const char* newIpAddress, const char* newSubnetMask = NULL, const char* newGateway = NULL) = 0;
  97. /// \~chinese
  98. /// \brief 获取相机的当前访问权限
  99. /// \return 如果获取成功,返回的枚举值代表相机的当前访问权限,如果失败,返回的枚举值为accessPermissionUnknown
  100. /// \~english
  101. /// \brief get current access permission of camera
  102. /// \return success:return current access permission of camera, fail:return accessPermissionUnknown
  103. virtual ECameraAccessPermission getAccessPermission() const = 0;
  104. /// \~chinese
  105. /// \brief 获取相机的 Protocol Version
  106. /// \return 返回相机的 Protocol Version,失败:返回空字符串
  107. /// \~english
  108. /// \brief get Protocol Version of camera
  109. /// \return success:return camera's Protocol Version, fail:return empty string
  110. virtual Infra::CString getProtocolVersion() const = 0;
  111. /// \~chinese
  112. /// \brief 获取相机的 IP Configuration
  113. /// \return 返回相机的 IP Configuration,失败:返回空字符串
  114. /// \~english
  115. /// \brief get IP Configuration of camera
  116. /// \return success:return camera's IP Configuration, fail:return empty string
  117. virtual Infra::CString getIPConfiguration() const = 0;
  118. /// \~chinese
  119. /// \brief 设置相机对sdk命令的响应超时时间
  120. /// \param [in] timeout 超时时间,单位ms
  121. /// \return 是否设置成功
  122. /// \~english
  123. /// \brief Set the response timeout interval of camera sends command to SDK
  124. /// \param [in] Timeout interval, unit:ms
  125. /// \retval false Configuration fail
  126. /// \retval true Configuration success
  127. virtual bool setAnswerTimeout(uint16_t timeout) = 0;
  128. /// \~chinese
  129. /// \brief 获取相机的 IP Configuration options
  130. /// \return 返回相机的 IP Configuration options,失败:返回0
  131. /// \return value:4 相机只支持LLA
  132. /// \return value:5 相机支持LLA和Persistent IP
  133. /// \return value:6 相机支持LLA和DHCP
  134. /// \return value:7 相机支持LLA、DHCP和Persistent IP
  135. /// \return value:0 失败
  136. /// \~english
  137. /// \brief get IP Configuration options of camera
  138. /// \return success:return camera's IP Configuration options, fail:return 0
  139. /// \return value:4 camera supports LLA
  140. /// \return value:5 camera supports LLA and Persistent IP
  141. /// \return value:6 camera supports LLA and DHCP
  142. /// \return value:7 camera supports LLA, DHCP and Persistent IP
  143. /// \return value:0 fail
  144. virtual uint32_t getIpConfigOptions() const = 0;
  145. /// \~chinese
  146. /// \brief 获取相机当前的 IP Configuration options
  147. /// \return 返回相机当前的 IP Configuration options,失败:返回0
  148. /// \return value:4 LLA使能
  149. /// \return value:5 LLA和Persistent IP使能
  150. /// \return value:6 LLA和DHCP使能
  151. /// \return value:7 LLA、DHCP和Persistent IP使能
  152. /// \return value:0 失败
  153. /// \~english
  154. /// \brief get current IP Configuration options of camera
  155. /// \return success:return camera's current IP Configuration options, fail:return 0
  156. /// \return value:4 LLA is active
  157. /// \return value:5 LLA and Persistent IP are active
  158. /// \return value:6 LLA and DHCP are active
  159. /// \return value:7 LLA, DHCP and Persistent IP are active
  160. /// \return value:0 fail
  161. virtual uint32_t getIpConfigCurrent() const = 0;
  162. };
  163. /// @}
  164. GENICAM_NAMESPACE_END
  165. #endif//__DAHUA_GENICAM_IGIGECAMERA_H__