// 文字消息回调函数定义 void CALLBACK Widget::TextMessage_CallBack(DWORD dwFromUserid, DWORD dwToUserid, BOOL bSecret, LPCTSTR lpMsgBuf, DWORD dwLen, LPVOID lpUserValue) { BR_AFX_MANAGE_STATE; Widget* pDemoDlg = (Widget*)lpUserValue; QString message; if(pDemoDlg) { QDateTime time = QDateTime::currentDateTime(); //获取系统当前时间 QString strTime = time.toString(" yyyy-MM-dd hh:mm:ss "); CHAR username[30]; pDemoDlg->m_AnyChatSDK.GetUserName(dwFromUserid,username,sizeof(username)); pDemoDlg->AppendLogString(username + strTime); message.sprintf("%s", lpMsgBuf); pDemoDlg->AppendLogString(message); } }
// SDK Filter 通信数据回调函数定义 void CALLBACK Widget::SDKFilterData_CallBack(LPBYTE lpBuf, DWORD dwLen, LPVOID lpUserValue) { Widget *pDemoDlg = (Widget*)lpUserValue; if(pDemoDlg) { QString strNotify; strNotify.sprintf("SDK Filter CallBack:%s",lpBuf); pDemoDlg->AppendLogString(strNotify); } }
// 录像、快照任务完成回调函数定义 void CALLBACK Widget::RecordSnapShot_CallBack(DWORD dwUserid, LPCTSTR lpFileName, DWORD dwParam, BOOL bRecordType, LPVOID lpUserValue) { Widget *pDemoDlg = (Widget*)lpUserValue; if(pDemoDlg) { QString strNotify; strNotify.sprintf("%s CallBack:dwUserid-%d, FilePathName-%s",bRecordType?"Record":"SnapShot",(int)dwUserid,lpFileName); pDemoDlg->AppendLogString(strNotify); } }
// 文件传输回调函数定义 void CALLBACK Widget::TransFile_CallBack(DWORD dwUserid, LPCTSTR lpFileName, LPCTSTR lpTempFilePath, DWORD dwFileLength, DWORD wParam, DWORD lParam, DWORD dwTaskId, LPVOID lpUserValue) { Widget *pDemoDlg = (Widget*)lpUserValue; if(pDemoDlg) { QString strNotify; strNotify.sprintf("TransFile_CallBack:dwUserid-%d, lpFileName-%s, lpTempFilePath-%s",dwUserid,lpFileName,lpTempFilePath); pDemoDlg->AppendLogString(strNotify); } }
// 透明通道数据回调函数定义 void CALLBACK Widget::TransBuffer_CallBack(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen, LPVOID lpUserValue) { Widget *pDemoDlg = (Widget*)lpUserValue; if(pDemoDlg) { QString strNotify; strNotify.sprintf("TransBuffer_CallBack:dwUserid-%d, bufSize-%d",dwUserid,dwLen); pDemoDlg->AppendLogString(strNotify); } }
// 透明通道数据扩展回调函数定义 void CALLBACK Widget::TransBufferEx_CallBack(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen, DWORD wParam, DWORD lParam, DWORD dwTaskId, LPVOID lpUserValue) { Widget *pDemoDlg = (Widget*)lpUserValue; if(pDemoDlg) { BOOL bSuccess = FALSE; if(dwLen > 1000) { bSuccess = lpBuf[1000] == 'Y' ? TRUE : FALSE; } QString strNotify; strNotify.sprintf("TransBuffer_CallBack:dwUserid-%d, bufSize-%d",dwUserid,dwLen,bSuccess ? "Success" : "Fail"); pDemoDlg->AppendLogString(strNotify); } }