天地伟业解码器sdk二次开发
https://www.likecs.com/show-206201.html

我需要用C++实现,但我自己照着C#改也改不好,
应该回调函数这儿出问题了
这我自己一边现学一遍写的,大部分找着sdk的开发手册来的,肯定有问题,不知道怎么搞了
我看了几个老哥的回复,但是都不太沾边啊,我现在的问题是登录不上去,程序调用不了摄像头
我自己判断是回调函数那边有问题,但是我技术不够,解决不了



试了之后是-3一直是未登录

登录返回值是0,但是回调函数那边没反应
而且它这返回值是0,还返回一个ID,该怎么接收呢

#include<stdio.h>
#include"DecCtrlClient.h"
#include"ActionControl.h"
#include"DecCtrlClientTypes.h"
#include"GlobalTypes.h"
#include"net_sdk_types.h"
#include"RetValue.h"
#include"x_type.h"
#include <iostream>
using namespace std;
int g_iLogonID = -1;
//主回调
int tMainNotify(unsigned long _lID, unsigned int _uiMsg, unsigned int _iChannel, int _iPos, void* _pvParam, int _iParamSize, void* _pvUserData)
{
switch (_uiMsg)
{
case DEC_WCM_DEC_LOGON:
{
if (DEC_LOGON_SUCCESS == (int)_pvParam)
{
DEC_ClientGetLogonState((int)_lID);
cout << "登录成功" << endl;
}
cout << "登录失败" << endl;
break;
}
case DEC_WCM_ERR_ORDER:
break;
case DEC_WCM_DEC_PICSNAP:
cout << "抓拍" << endl;
break;
case DEC_WCM_DEC_GETPICFILENAME:
break;
//......
//......
//......
default:
cout << "未有正确消息值传递进来" << endl;
break;
}
return 0;
}
//参数改变回调函数
int tParaChangeNotify(unsigned long _lID, unsigned int _uiMsg, unsigned int _iChannel, int _iPos, void* _pvParam, int _iParamSize, void* _pvUserData)
{
switch (_uiMsg)
{
case DEC_PARACHANGE_ENCODERPAPA:
break;
//......
//......
//......
default:
cout << "未有消息值传递进来" << endl;
break;
}
return 0;
}
/*
int PrintScreen() {
int iRet = -1;
ServerItem tServerItem = { 0 };
tServerItem.iSize = sizeof(ServerItem);
PicSnap Sp = {0};
Sp.uServerItem = tServerItem;
//iRet = DEC_ClientSendCommand(g_iLogonID,0,0, DEC_COMMAND_PICSNAP, Sp,1024);
}
*/
int main() {
//初始化
DEC_ClientStartup(0,NULL);
//设置回调函数
DecNotifyFun tDecNotifyFun = { 0 };
tDecNotifyFun.iSize = sizeof(DecNotifyFun);
tDecNotifyFun.pMainNotify = tMainNotify;
tDecNotifyFun.pParamChangeNotify = tParaChangeNotify;
DEC_ClientSetNotify(&tDecNotifyFun);
//登录设备
g_iLogonID = DEC_ClientLogon("192.168.1.2", "Admin", "1111", 3000);
if (g_iLogonID < 0)
{
cout << g_iLogonID << endl;
OutputDebugString("Logon failed!\n");
}
//抓拍
cout << "****************" << endl;
//注销登录
DEC_ClientLogout(g_iLogonID);
//释放SDK资源
DEC_ClientCleanup();
return 0;
}