|
|
@@ -1,7 +1,7 @@
|
|
|
#include "takephoto.h"
|
|
|
|
|
|
// 模块名称
|
|
|
-static const char MODULE_NAME[] = "TakePhoto";
|
|
|
+static const char MODULE_NAME[] = "HrTakePhoto";
|
|
|
|
|
|
// 相机类型
|
|
|
static unsigned int device_type = interfaceTypeGige | interfaceTypeUsb3;
|
|
|
@@ -25,7 +25,7 @@ typedef struct
|
|
|
HANDLE hCam; // 打开相机的句柄
|
|
|
uint32_t camType; // 相机类型:U、网
|
|
|
char manuName[MAX_LINE_CHARS]; //制造厂商名称
|
|
|
- DHImgType saveImgType; // 保存图像的类型
|
|
|
+ DHImgType saveImgType; // 保存图像的类型
|
|
|
const char *saveImgPath; // 保存图像的路径
|
|
|
bool isExposureAuto; // 自动曝光:是/否
|
|
|
struct timespec expTime0; // 曝光开始的时间
|
|
|
@@ -46,6 +46,24 @@ static bool is_huaray_manu_alias(const char *name)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+static void OnFrameReceived(IMV_Frame *pFrame, void *pUser) // 数据帧的回调, 完成一次拍照任务
|
|
|
+{
|
|
|
+ PthotoProcCtx *ctx = (PthotoProcCtx *)pUser;
|
|
|
+ if(NULL == pFrame) return;
|
|
|
+ sw_log_debug("[%s] +++GetOneFrame+++, Width[%u], Height[%u], FrameNum[%llu], FrameLen[%u], PixelType[0x%08X]", MODULE_NAME,
|
|
|
+ pFrame->frameInfo.width, pFrame->frameInfo.height, pFrame->frameInfo.blockId, pFrame->frameInfo.size,
|
|
|
+ (unsigned int)pFrame->frameInfo.pixelFormat);
|
|
|
+}
|
|
|
+
|
|
|
+static int FrameSoftTrigger(unsigned long wParam, unsigned long lParam) // 线程回调函数, 触发一次拍照执行
|
|
|
+{
|
|
|
+ PthotoProcCtx *ctx = (PthotoProcCtx *)wParam;
|
|
|
+ int ret = IMV_ExecuteCommandFeature(ctx->hCam, "TriggerSoftware");
|
|
|
+ if(IMV_OK != ret) ret = 1; // 软触发失败后, 马上再次触发
|
|
|
+ else ret = 1000; // 软触发成功后-延时一秒, 等待下次的触发
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
// 单次执行相机拍照, 并保存到文件, 成功返回: 0值, 失败返回:非0值
|
|
|
// "imgType" - 获取图像类型
|
|
|
// "saveImgPath" - 保存的文件名
|