|
1.
BVCU_Command cmdInfo;
memset(&cmdInfo, 0, sizeof(cmdInfo));
cmdInfo.iSize = sizeof(cmdInfo);
cmdInfo.iMethod = BVCU_METHOD_QUERY;
cmdInfo.iSubMethod = BVCU_SUBMETHOD_PU_LIST;
cmdInfo.OnEvent = cmd_OnEvent;
BvResult = BVCU_SendCmd(hSession, &cmdInfo);
这段代码cmd_OnEvent这个回调被执行了两次是为什么
// 发送命令的回调
static void cmd_OnEvent(BVCU_HSession hSession, BVCU_Command* pCommand, int iEventCode, void* pParam)
{
BVCU_Event_SessionCmd* pEvent = (BVCU_Event_SessionCmd*)pParam;
switch (pCommand->iMethod)
{
case BVCU_METHOD_QUERY:
if (BVCU_SUBMETHOD_PU_LIST == pCommand->iSubMethod)
{
printf("执行获取设备列表回调: \r\n");
if (pEvent->stContent.iDataCount > 0)
{
BVCU_PUChannelInfo* puChannelInfo = (BVCU_PUChannelInfo*)(pEvent->stContent.pData);
printf(" index puID puName status \r\n");
printf(" channelName mediaDir PTZIndex \r\n");
for (int i = 0; i < pEvent->stContent.iDataCount; ++i)
{
printf("Index: [%d] 设备 id: %s 设备名称 : %s 设备在线状态: %d \r\n", i + 1, puChannelInfo[i].szPUID,
puChannelInfo[i].szPUName, puChannelInfo[i].iOnlineStatus);
for (int j = 0; j < puChannelInfo->iChannelCount; ++j)
{
printf("\t");
printf("通道名: %s 通道媒体方向: %d 通道云台索引 : %d\r\n", puChannelInfo[i].pChannel[j].szName,
puChannelInfo[i].pChannel[j].iMediaDir, puChannelInfo[i].pChannel[j].iPTZIndex);
}
}
}
else
{
printf("无设备列表或者获取设备列表结束\r\n");
SetEvent(g_hEvent);
}
}
break;
default:
break;
}
}
2.执行打开GPS会话
dlgParam.hSession = hSession;
dlgParam.OnEvent = OnEventDialog;
dlgParam.afterDecode = afterDecode_GPS;
dlgParam.iTargetCount = 1;
dlgParam.pTarget = &targetPu;
targetPu.iIndexMajor = 65536; // GPS通道号,BVCU_SUBDEV_INDEXMAJOR_MIN_GPS——BVCU_SUBDEV_INDEXMAJOR_MAX_GPS之间
targetPu.iIndexMinor = -1; // 流号
dlgParam.iAVStreamDir = BVCU_MEDIADIR_DATARECV;
strcpy_s(targetPu.szID,32, szID); //
// 设置会话网络参数
memset(&dlgCtrlParam, 0, sizeof(dlgCtrlParam));
dlgCtrlParam.iSize = sizeof(dlgCtrlParam);
dlgCtrlParam.stNetwork.iDelayMin = 1000; // 最小延时1秒钟
dlgCtrlParam.stNetwork.iDelayMax = 5000; // 最大延时6秒钟
dlgCtrlParam.stNetwork.iDelayVsSmooth = 3; // 平滑设置,1——7
dlgCtrlParam.stRender.iPlackbackVolume = 50;
dlgCtrlParam.stRender.iCaptureVolume = 50;
BVCU_Result BvResult;
BvResult = BVCU_Dialog_Open(&hDialog, &dlgParam, &dlgCtrlParam);
为什么在OnEventDialog回调里iEventCode=BVCU_EVENT_DIALOG_OPEN消息下pParam的iResult会等于BVCU_RESULT_E_VTDU_NONE,这个是什么意思,文档没有说明 |
|