I will call in python SDK in the callback function that now, after registration in the callback function, the callback function is not running, have done with cameras for secondary development friend can help me have a look at my code to what is going wrong,
C source code is written like this:
NET_SDK_SetSubscribCallBack (SubscribCallBack, this);
Void CALLBACK CSDKDEMODlg: : SubscribCallBack (LONG lUserID, dwords dwCommand, char * pbufs, dwords dwBufLen, void * pUser)
{
The switch (dwCommand)
{
//IVE_VFD_RESULT_HEAD_T + [IVE_VFD_RESULT_DATA_INFO_T + source data] + [IVE_VFD_RESULT_FACE_DATA_INFO_T + face data + face feature value] +... + + face feature value] [IVE_VFD_RESULT_FACE_DATA_INFO_T + face data
Case NET_SDK_N9000_ALARM_TYPE_VFD:
{
TRACE (" NET_DVR_SMART_VFD dwBufLen=% d \ n ", dwBufLen);
If (dwBufLen & lt; Sizeof (NET_DVR_IVE_VFD_RESULT_HEAD_T))
{
break;
}
Char * TMP=pbufs;
//parsing head
TMP NET_DVR_IVE_VFD_RESULT_HEAD_T * head=(NET_DVR_IVE_VFD_RESULT_HEAD_T *);
TMP +=sizeof (NET_DVR_IVE_VFD_RESULT_HEAD_T);
//parsing the raw data
TMP NET_DVR_IVE_VFD_RESULT_DATA_INFO_T * SRC=https://bbs.csdn.net/topics/(NET_DVR_IVE_VFD_RESULT_DATA_INFO_T *);
TMP +=sizeof (NET_DVR_IVE_VFD_RESULT_DATA_INFO_T);
If (SRC - & gt; DataLen & gt; 0)
{
TRACE (" SRC - & gt; DataLen=% d, SRC - & gt; Width=% d, SRC - & gt; Height=% d \ n ", SRC - & gt; DataLen, SRC - & gt; Width, SRC - & gt; Height);
//the source data
Char * img=new char [SRC - & gt; dataLen];
Memcpy (img, TMP, SRC - & gt; DataLen);
The delete img.
TMP +=SRC - & gt; DataLen;
}
My python callback is such a call:
The from TWfunc. Ai_alarm import net_SDK_SetSubscribCallBack
The from TWfunc. SubscribCallBack import *
The from TWfunc. Toolfunc. Errordict import errorinfo
The import time
Pbufs=POINTER (CHAR)
PUser=POINTER (c_void_p)
SUBSCRIBE_CALLBACK=WINFUNCTYPE (None, LONG, c_ulong, pbufs, c_ulong, pUser)
Def, _callback, (lUserID dwCommand, pbufs, dwBufLen, pUser) :
# lUserID,
TWdll. Printf (" test ")
# obj=para. __getitem__ (0)
# print (obj)
Print (" callback ")
# print (lUserID dwCommand, pbufs. Value, dwBufLen, pUser)
# print (dwCommand)
CALL_BACK_FUN=SUBSCRIBE_CALLBACK (, _callback,)
If __name__=="__main__" :
# p=Pool (3)
CAM=TWCamera ()
PUser=POINTER (c_void_p) ()
Print (type (CALL_BACK_FUN))
Ret=cam.net _SDK_SetSubscribCallBack (CALL_BACK_FUN pUser)
Time. Sleep (10)
Print (ret)
If ret:
Print (" callback success ")
Sys. The exit ()
Is to call the callback, next above is register callback interface:
The class TWCamera () :
Def __init__ (self) :
# self. LUserID=
Self. _handle=c_void_p ()
Self. Handle=pointer (self. _handle)
Def net_SDK_SetSubscribCallBack (self, CallBackFun pUser) :
Net_sdk_login ()
TWdll.NET _SDK_SetSubscribCallBack. Argtypes=(c_void_p c_void_p)
TWdll.NET _SDK_SetSubscribCallBack. Restype=BOOL
# info=libc.NET _SDK_SetSubscribCallBack (CallBackFun, pUser)
# time. Sleep (20)
Return to TWdll.NET _SDK_SetSubscribCallBack (CallBackFun pUser)
Results:
The SDK initialization success
Set the timeout success
The user login successfully, lUserID is 1 & lt; The class 'int' & gt;
True
The callback success
The callback function is not implemented,