Exemplo n.º 1
0
void CPannelDecoder::OnBtnAddDecoder() 
{
	// TODO: Add your control notification handler code here
	CNVDSDKDemoDlg *pParentDlg = (CNVDSDKDemoDlg*)this->GetParent();

	CAddDecoderDlg dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		CLIENT_SetOperateCallBack(dlg.m_lLoginHandle, MessDataCallBackFunc, (DWORD)pParentDlg);
		CLIENT_SetDecPlaybackPos(dlg.m_lLoginHandle, DecPlayBackPosFunc, (DWORD)pParentDlg);
		CLIENT_StartListenEx(dlg.m_lLoginHandle);

		DECODER_INFO *pDecoderInfo = new DECODER_INFO();
		if (pDecoderInfo != NULL)
		{
			pDecoderInfo->strDecName = dlg.m_strDecName;
			pDecoderInfo->strDecUser = dlg.m_strDecUser;
			pDecoderInfo->strDecPwd = dlg.m_strDecPwd;
			pDecoderInfo->strDecIp = dlg.m_strDecIp;
			pDecoderInfo->nDecPort = dlg.m_nDecPort;
			pDecoderInfo->lLoginID = dlg.m_lLoginHandle;
			pDecoderInfo->nDecChannel = dlg.m_nDecChannel;
			pDecoderInfo->bIsOnline = TRUE;
			for (int i = 0; i < NVD_ENCODER_MAX; i++)
			{
				pDecoderInfo->dwTotalSize[i] = 0;
				pDecoderInfo->dwCurSize[i] = 0;
			}
				
			BOOL bRet = CLIENT_QueryDecoderInfo(dlg.m_lLoginHandle, &pDecoderInfo->devDecInfo);
			if (FALSE == bRet)
			{
				MessageBox(ConvertString("Query NVD failed!"), ConvertString("Prompt"));
 			}
			
			if (pDecoderInfo->devDecInfo.nMonitorNum != pDecoderInfo->nDecChannel)
			{
				// 
			}
					
			CReadWriteMutexLock lock(pParentDlg->m_csDecoder);
			pParentDlg->m_lstDecoders.push_back(pDecoderInfo);
			lock.Unlock();

			pParentDlg->UpdateDecoderList();
		}		
	}
}
Exemplo n.º 2
0
void CDlgTalk::OnCheckTalkAttachEvent() 
{
	// 订阅事件
    if (IsDlgButtonChecked(IDC_CHECK_TALK_ATTACH_EVENT))
    {
        CLIENT_SetDVRMessCallBack(EventCallBack, (LDWORD)this);

        if (CLIENT_StartListenEx(m_lLoginID))
        {
            // 订阅成功
        }
        else
        {
            MessageBox(ConvertString("Attach event error."), ConvertString("Prompt"));
        }
    }
    // 取消订阅
    else
    {
        CLIENT_StopListen(m_lLoginID);
    }
}