大华工业相机c++软触发代码

/// \file
/// ~chinese
/// \brief 软触发示例
/// \example SoftTrigger.cpp
/// ~english
/// \brief soft trigger sample
/// \example SoftTrigger.cpp

//**********************************************************************
// 本Demo为简单演示SDK的使用,没有附加修改相机IP的代码,在运行之前,请使
// 用相机客户端修改相机IP地址的网段与主机的网段一致。
// This Demo shows how to use GenICam API© to write a simple program.
// Please make sure that the camera and PC are in the same subnet before running the demo.
// If not, you can use camera client software to modify the IP address of camera to the same subnet with PC.
// 本工程演示了发现设备,连接设备,设置软触发,软触发,断开连接操作
// This program shows how to discover and connect device, set software trigger config, execute software trigger and disconnect device
//**********************************************************************

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Windows.h>
#include <process.h>
#include "IMVApi.h"

bool g_isExitThread = false;

unsigned __stdcall executeSoftTriggerProc(void* pUserData)
{
	int ret = IMV_OK;
	IMV_HANDLE devHandle = (IMV_HANDLE)pUserData;
	if (NULL == devHandle)
	{
		return 0;
	}

	while (!g_isExitThread)
	{
		// 执行软触发
		// Execute soft trigger 
		ret = IMV_ExecuteCommandFeature(devHandle, "TriggerSoftware");
		if (IMV_OK != ret)
		{
			printf("Execute TriggerSoftware failed! ErrorCode[%d]\n", ret);
			continue;
		}

		// 通过睡眠时间来调节帧率
		// Adjust the frame rate by sleep time
		Sleep(50);
	}

	return 0;
}

// 数据帧回调函数
// Data frame callback function
static void onGetFrame(IMV_Frame* pFrame, void* pUser)
{
	if (pFrame == NULL)
	{
		printf("pFrame is NULL\n");
		return;
	}

	printf("Get frame blockId = %llu\n", pFrame->fra
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值