Camera.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #ifndef __DAHUA_GENICAM_ICAMERA_H__
  2. #define __DAHUA_GENICAM_ICAMERA_H__
  3. #include "Defs.h"
  4. #include "Frame.h"
  5. #include "Memory/SharedPtr.h"
  6. #include "StreamSource.h"
  7. GENICAM_NAMESPACE_BEGIN
  8. /// \~chinese
  9. /// \brief 相机对象接口类
  10. /// \defgroup Camera 相机共用操作接口
  11. /// @{
  12. /// \~english
  13. /// \brief Camera Object Interface Class
  14. /// \defgroup Camera Camera's Common Operation Interface
  15. /// @{
  16. /// \~chinese
  17. /// \brief Class ICamera 相机对象接口类,表示一台相机,所有协议类型都可共用的接口。该实例对象可通过CSystem获取
  18. /// \~english
  19. /// \brief Class ICamera Camera Object Interface Class, it means a common interface for all protocol type; This instance object can be got by CSystem
  20. class GENICAM_API ICamera
  21. {
  22. protected:
  23. /// \~chinese
  24. /// \brief 析构函数
  25. /// \~english
  26. /// \brief destruct function
  27. virtual ~ICamera(){}
  28. public:
  29. enum ECameraAccessPermission
  30. {
  31. accessPermissionOpen = 0, ///< \~chinese GigE相机没有被连接 ///< \~english The GigE vision device isn't connected to any application.
  32. accessPermissionExclusive, ///< \~chinese 独占访问权限 ///< \~english Exclusive Access Permission
  33. accessPermissionControl, ///< \~chinese 非独占可读访问权限 ///< \~english Non-Exclusive Readbale Access Permission
  34. accessPermissionControlWithSwitchover, ///< \~chinese Control access with switchover enabled. ///< \~english Control access with switchover enabled.
  35. accessPermissionUnknown = 254, ///< \~chinese 无法确定 ///< \~english Value not known; indeterminate.
  36. accessPermissionUndefined ///< \~chinese 未定义访问权限 ///< \~english Undefined Access Permission
  37. };
  38. enum ECameraType
  39. {
  40. typeGige = 0, ///< \~chinese GIGE相机 ///< \~english GigE Vision Camera
  41. typeU3v = 1, ///< \~chinese USB3.0相机 ///< \~english USB3.0 Vision Camera
  42. typeCL = 2, ///< \~chinese CAMERALINK 相机///< \~english Cameralink camera
  43. typePCIe = 3, ///< \~chinese PCIe相机 ///< \~english PCIe Camera
  44. typeUndefined = 255 ///< \~chinese 未知类型 ///< \~english Undefined Camera
  45. };
  46. /// \~chinese
  47. /// \brief 得到相机类型
  48. /// \return 返回相机类型
  49. /// \~english
  50. /// \brief get Camera Type
  51. /// \return Success: Camera Type, Failure:typeUndefined
  52. virtual int32_t getType() const = 0;
  53. /// \~chinese
  54. /// \brief 获取相机名称
  55. /// \return 返回相机名称
  56. /// \~english
  57. /// \brief get Camera Name
  58. /// \return Success:Camera Name, Failure:NULL
  59. virtual const char * getName() = 0;
  60. /// \~chinese
  61. /// \brief 获取相机的唯一标识.
  62. /// \return 唯一标识相机的字符串.
  63. /// \~english
  64. /// \brief get Camera Unique Indentification
  65. /// \return Success:Identification (Key), Failure:NULL
  66. virtual const char * getKey() = 0;
  67. /// \~chinese
  68. /// \brief 连接设备
  69. /// 与相机建立连接关系,如Gige Vision协议的相机即是获得控制权限、创建控制通道
  70. /// \param [in] accessPermission 打开相机控制通道时默认为control access 权限
  71. /// \return 是否连接成功
  72. /// \~english
  73. /// \brief connect to camera
  74. /// get the control permission of camera, and create the control channel
  75. /// \param [in] accessPermission Control access permission is default when open the control channel of the camera
  76. /// \retval false connection failed
  77. /// \retval true connection successful
  78. virtual bool connect(ECameraAccessPermission accessPermission = accessPermissionControl) = 0;
  79. /// \~chinese
  80. /// \brief 断开连接
  81. /// 断开与相机的连接关系,如Gige Vision协议的相机即是释放控制权限、销毁控制通道
  82. /// \return 是否断开成功
  83. /// \~english
  84. /// \brief disconnect camera
  85. /// release the control permission of camera, and withdraw the control channel
  86. /// \retval false disconnection failed
  87. /// \retval true disconnection successful
  88. virtual bool disConnect() = 0;
  89. /// \~chinese
  90. /// \brief 判断相机当前是否处于已连接状态
  91. /// \return 是否已连接
  92. /// \~english
  93. /// \brief check the camera is connected or disconnected
  94. /// \retval false camera is disconnected
  95. /// \retval true camera is connected
  96. virtual bool isConnected() = 0;
  97. /// \~chinese
  98. /// \brief 获取相机所属的接口名
  99. /// \return 设备所属的接口名
  100. /// \~english
  101. /// \brief get the name of interface which is used for connecting the camera
  102. /// \return Success:Interface Name, Failure:NULL
  103. virtual const char * getInterfaceName() = 0;
  104. /// \~chinese
  105. /// \brief 获取相机所连接的接口类型
  106. /// \return 相机所连接的接口类型
  107. /// \~english
  108. /// \brief get the type of interface which is used for connecting the camera
  109. /// \return the type of interface
  110. virtual int32_t getInterfaceType() const = 0;
  111. /// \~chinese
  112. /// \brief 下载相机描述XML文件
  113. /// 下载相机描述文件,并保存到指定路径
  114. /// \param [in] aFullFilename 文件要保存的路径
  115. /// \return 是否下载成功
  116. /// \~english
  117. /// \brief download camera description XML file
  118. /// download camera description files, and save the files to specified path
  119. /// \param [in] aFullFilename The full paths where the downloaded XMl files would be saved to
  120. /// \retval false download failed
  121. /// \retval true download successful
  122. virtual bool downLoadGenICamXML(const char* aFullFilename) = 0;
  123. /// \~chinese
  124. /// \brief 读用户自定义数据。相机内部保留32768字节用于用户存储自定义数据(此功能针对本品牌相机,其它品牌相机无此功能)。
  125. /// \param [out] pBuffer 数据缓冲的指针。
  126. /// \param [in] dwCount 期望读出的字节数
  127. /// \return 返回用户实际读取到的字节数
  128. /// \~english read user-defined data; Inside the camera, there are 32768 bytes reserved for user to store private data (Only our own camera has this function)
  129. /// \param [out] pBuffer pointer of the data buffer
  130. /// \param [in] dwCount byte count expected
  131. /// \return return byte count read in fact
  132. virtual size_t readUserPrivateData(void* pBuffer, size_t dwCount) = 0;
  133. /// \~chinese
  134. /// \brief 写用户自定义数据。和readUserPrivateData对应
  135. /// \param [in] pBuffer 数据缓冲的指针。
  136. /// \param [in] dwCount 期望写入的字节数
  137. /// \return 返回用户实际写入的字节数
  138. /// \~english write user-defined data; Inside the camera, there are 32768 bytes reserved for user to store private data (Only our own camera has this function)
  139. /// \param [out] pBuffer pointer of the data buffer
  140. /// \param [in] dwCount byte count expected
  141. /// \return return byte count written in fact
  142. virtual size_t writeUserPrivateData(const void *pBuffer, size_t dwCount) = 0;
  143. /// \~chinese
  144. /// \brief 获取相机制造厂商名称
  145. /// \return 返回相机制造厂商名称
  146. /// \~english
  147. /// \brief get the vendor name of this camera
  148. /// \return camera's vendor, return NULL if failed
  149. virtual const char * getVendorName() = 0;
  150. /// \~chinese
  151. /// \brief 获取相机型号
  152. /// \return 返回相机型号
  153. /// \~english
  154. /// \brief get the model name of this camera
  155. /// \return camera's model name, return NULL if failed
  156. virtual const char * getModelName() = 0;
  157. /// \~chinese
  158. /// \brief 获取相机序列号
  159. /// \return 返回相机序列号
  160. /// \~english
  161. /// \brief get serial number of this camera
  162. /// \return camera's serial number, return NULL if failed
  163. virtual const char * getSerialNumber() = 0;
  164. /// \~chinese
  165. /// \brief 获取相机固件版本号
  166. /// \return 返回相机固件版本号
  167. /// \~english
  168. /// \brief get device version of this camera
  169. /// \return camera's device version, return NULL if failed
  170. virtual const char * getDeviceVersion() = 0;
  171. /// \~chinese
  172. /// \brief 往相机串口寄存器写数据,每次写会清除掉上次的数据(此功能只支持包含串口功能的本品牌相机 )
  173. /// \param [in] pBuffer 数据缓冲的指针。
  174. /// \param [in] dwCount 期望写入的字节数
  175. /// \return 返回用户实际写入的字节数
  176. /// \~english write serial data to camera serial register, will erase the data writen before (Only our own camera with Serial Port has this function)
  177. /// \param [in] pBuffer pointer of the data buffer
  178. /// \param [in] dwCount byte count expected
  179. /// \return return byte count written in fact
  180. virtual size_t writeUARTData(const void* pBuffer, size_t dwCount) = 0;
  181. /// \~chinese
  182. /// \brief 从相机串口寄存器读取串口数据(此功能只支持包含串口功能的本品牌相机 )
  183. /// \param [out] pBuffer 数据缓冲的指针。
  184. /// \param [in] dwCount 期望读出的字节数
  185. /// \return 返回用户实际读取到的字节数
  186. /// \~english read serial data from camera serial register (Only our own camera with Serial Port has this function)
  187. /// \param [out] pBuffer pointer of the data buffer
  188. /// \param [in] dwCount byte count expected
  189. /// \return return byte count read in fact
  190. virtual size_t readUARTData(void* pBuffer, size_t dwCount) = 0;
  191. /// \~chinese
  192. /// \brief 获取相机制造信息
  193. /// \return 返回相机制造信息,失败:返回NULL
  194. /// \~english
  195. /// \brief get manufacture info of this camera
  196. /// \return camera's manufacture info, return NULL if failed
  197. virtual const char * getManufactureInfo() = 0;
  198. };
  199. typedef Memory::TSharedPtr<ICamera> ICameraPtr;
  200. /// @}
  201. GENICAM_NAMESPACE_END
  202. #endif//__DAHUA_GENICAM_ICAMERA_H__