⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sampledlg.cpp

📁 TM8000硬盘录像机客户端编程文档和Demo源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
{
	char *Buf;
	Buf=(char*)wParam;
	WORD wChannelMask=0;
	unsigned long   nIpAddr;
	unsigned short  nServPort;
	short Len;
	int i,j,nDiskNo;
	WORD wSens;
	long DiskSpace,FreeDisk;
	CString str;
	CString cTemp5;
//	int iTemp;
	BYTE bTemp;
	CString cTemp,cTemp1;
	int iData[7];
	int jj=0;
	int iCount;
	int nBufLen=0;
	if(lParam==1)
	{
		memcpy(&nIpAddr,Buf+3,4);
		memcpy(&nServPort,Buf+7,2);
		switch((unsigned char)Buf[0])
		{
		case  NETCOM_NODENOTIFY :
			Len=Buf[1];
			Buf[Len]= '\0';
			AddNetNode(nIpAddr,nServPort, Buf+9);
			break ;
		case  NETCOM_LOGIN_OK :
			DVRHardWareType = (int)Buf[10];
			NetNodeLoginOK(nIpAddr,nServPort, Buf[9],DVRHardWareType);	
			break ;
		case NETCOM_PLAY_REALIMAGE_OK:
			NetSetRealImage(nIpAddr,nServPort,Buf+9);
			break;
		//case NETCOM_PLAY_REALIMAGE_NOK:			
			//AfxMessageBox("Open Real Image Failed!");
		//	break;
		case PLAYREALIMAGE_ERROR://实时图像失败
		case PLAYRECFILE_ERROR://远程回放失败
		case BACKUPRECFILE_ERROR://备份文件失败
			switch(Buf[9])
			{
			case CREATESOCK_FAIL:
				if(ENGLISH)
				{
					AfxMessageBox("Create Socket Failed!");//English
				}
				else
				{
					AfxMessageBox("创建socket失败!");//Chinese
				}
				break;
			case SETSOCKETOPT_FAIL:
				if(ENGLISH)
				{
					AfxMessageBox("Set Socket Parameter Failed!");//English
				}
				else
				{
					AfxMessageBox("设置socket参数失败!");//Chinese
				}			
				break;
			case SOCKETLINK_FAIL:
				if(ENGLISH)
				{
					AfxMessageBox("Connect Server Error!");//English 
				}
				else
				{
					AfxMessageBox("连接主机失败!");//Chinese
				}				
				break;
			case BACKUPFILE_REPEATFILE:
				if(ENGLISH)
				{
					m_state.Format("Backup Failed!Please Delete The Same File!Tye Again!");//English
				}
				else
				{
					m_state.Format("备份失败!请删除相同的文件后重试!");//Chinese
				}
				UpdateData(FALSE);
				break;
			}
			break;			
		case  NETCOM_RECORD_DATE:
			memcpy(&Len,&Buf[1],2);
			Buf[Len] = '\0' ;
			AddNetNodeRecDate(nIpAddr,nServPort, Buf+9);
			break ;
		case  NETCOM_RECORD_FILE:
			memcpy(&Len,&Buf[1],2);
			Buf[Len] = '\0' ;
			AddNetNodeRecFile(nIpAddr,nServPort, Buf+9) ;
			break ;		
		case NETCOM_NOAUTHORITY:
			if(ENGLISH)
			{
				m_state.Format("No Authority For Remote Backup File!");//English
			}
			else
			{
				m_state.Format("您当前的权限不能进行远程备份!");//Chinese
			}
			UpdateData(FALSE);
			break;
		case BACKUPRECFILE_NOSPACE:
			if(ENGLISH)
			{
				m_state.Format("No Enough Disk Space!");//English
			}
			else
			{
				m_state.Format("磁盘空间不足!");//Chinese
			}
			UpdateData(FALSE);
			break;
			break;
		case  NETCOM_RECORFILE_END:
			if(ENGLISH)
			{
				m_state.Format("Backup File End");//English
			}
			else
			{
				m_state.Format("备份结束");//Chinese
			}
			UpdateData(FALSE);
			break ;
		case NETCOM_PLAYRECFILE_END:
			if(ENGLISH)
			{
				m_state=_T("Remote Play End");//English
			}
			else
			{
				m_state=_T("远程回放结束");//Chinese
			}	
			UpdateData(FALSE);
			break;
		case  NETCOM_BACKUP_REGSEG_FAIL:
			if(ENGLISH)
			{
				AfxMessageBox("Backup File Failed");//English
			}
			else
			{
				AfxMessageBox("远程备份文件失败");//Chinese
			}						
			break ;
		case  NETCOM_BACKUP_STOP_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Backup File Stop");//English
			}
			else
			{
				AfxMessageBox("远程备份文件停止");//Chinese
			}			
			break ;
		case  NETCOM_CTRL_SETDEFAULT_VIDEOPARA:
			if(ENGLISH)
			{
				AfxMessageBox("Restore Default Video Parameter");//English
			}
			else
			{
				AfxMessageBox("远程恢复默认视频参数");//Chinese
			}			
			break;
		case  NETCOM_CTRL_SETNETADDR_OK:	
			if(ENGLISH)
			{
				AfxMessageBox("Set Net Attribute Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置网络属性成功!");//Chinese 
			}			
			break ;
		case  NETCOM_CTRL_SETDEFAULT_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Restore Default Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("远程恢复默认参数成功!");//Chinese 
			}					
			break ;
		case  NETCOM_CTRL_SAVEFLASH_OK:	
			if(ENGLISH)
			{
				AfxMessageBox("Save Parameter To Flash Success!");//English
			}
			else
			{
				AfxMessageBox("远程保存参数到Flash成功!");//Chinese
			}			
			break ;
		case  NETCOM_CTRL_REC_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Record Success!");//English
			}
			else
			{
				AfxMessageBox("录像成功!");//Chinese
			}
			break ;
		case  NETCOM_CTRL_RECSET_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Remote Record Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置录像参数成功!");//Chinese
			}
			break ;
		case  NETCOM_CTRL_SCHRECSET_OK:	
			if(ENGLISH)
			{
				AfxMessageBox("Set Remote Timer Record Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置定时录像参数成功!");//Chinese
			}
			break ;
		case  NETCOM_CTRL_MALARMRECSET_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Video Move Alarm Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置视频移动报警录像参数成功!");//Chinese
			}			
			break ;
		case  NETCOM_CTRL_PALARMRECSET_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Probe Alarm Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置探头报警录像参数成功!");//Chinese
			}			
			break ;
		case  NETCOM_CTRL_MOTIONCHECK_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Video Move Alarm Region Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置视频移动侦测区域成功!");//Chinese
			}			
			break ;
		case  NETCOM_CTRL_TERMTITLE_OK:	
			if(ENGLISH)
			{
				AfxMessageBox("Set Channel Title Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置通道名称成功!");//Chinese
			}			
			break ;
		case NETCOM_SET_TEXT_OVERLAP:
			if(ENGLISH)
			{
				AfxMessageBox("Set OSD Param Success!");//English
			}
			else
			{
				AfxMessageBox("远程OSD属性成功!");//Chinese
			}			
			break;
		case  NETCOM_PLAY_RECFILE_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Playback File Success!");//English
			}	
			else
			{
				AfxMessageBox("回放录像文件成功!");//Chinese
			}
			
			break ;
		case NETCOM_LOGIN_PASSWD_ERROR:
			if(ENGLISH)
			{
				AfxMessageBox("Password Error");//English
			}
			else
			{
				AfxMessageBox("密码错误");//Chinese
			}			
			break;
		case  NETCOM_SEND_ALARM:		 
			ServerAlarmPro(nIpAddr,nServPort,&Buf[9]);
			break ;
			//------------------------------------
			
		case  NETCOM_BACK_SYSTEMPARA_OK:
			if(Con_pDVRPara==NULL)
			{
				Con_pDVRPara=new USER_DVR_PARAMETER;
				
			}
			
			memcpy(Con_pDVRPara,Buf+9,sizeof(USER_DVR_PARAMETER));
			pNetRemoteCtlDlg->SetIpPort(nIpAddr,nServPort,0);
			pNetRemoteCtlDlg->Refresh();
			UpdateData(FALSE);
			SetDlgItemText(IDC_STATIC_GETPARA,"");
			break ;
		case NETCOM_CTRL_SENDNAME_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Server Name Success!");//English
			}
			else
			{
				AfxMessageBox("远程设主机名称成功!");//Chinese
			}			
			break;
		case NETCOM_CTRL_SYSTIME_OK:
            cTemp.Format("%s",Buf+9); 			
			for(iCount=0;iCount<=cTemp.GetLength();iCount++)
			{
				if(jj==6)
				{
                  iData[jj]=atoi(cTemp.Mid(0,1));
				  break;
				}
				if(cTemp.GetAt(iCount)==' ')
				{
					iData[jj] = atoi(cTemp.Mid(0,iCount));
                    cTemp = cTemp.Right(cTemp.GetLength()-iCount-1);
					jj++;
					iCount=0;
				}	
				nBufLen = cTemp.GetLength();
			}	
			pNetRemoteCtlDlg->ElseDlg.m_SysYear=iData[0];
			pNetRemoteCtlDlg->ElseDlg.m_SysMonth=iData[1];
			pNetRemoteCtlDlg->ElseDlg.m_SysDay=iData[2];
			pNetRemoteCtlDlg->ElseDlg.m_SysHour=iData[3];
			pNetRemoteCtlDlg->ElseDlg.m_SysMinute=iData[4];
			pNetRemoteCtlDlg->ElseDlg.m_SysSecond=iData[5];
			pNetRemoteCtlDlg->ElseDlg.m_SysWeek=iData[6];
			pNetRemoteCtlDlg->ElseDlg.UpdateData(FALSE);
			break;
		case NETCOM_CTRL_SETSYSTIME_OK:
			if(ENGLISH)
			{
				AfxMessageBox("Set System Time Success!");//English
			}
			else
			{
				AfxMessageBox("远程设置系统时间成功!");//Chinese
			}			
			break;
		case NETCON_REMOTE_SETPASSWORD:
			if(Buf[11]==1)
			{
				if(ENGLISH)
				{
					AfxMessageBox("Set System Password Success!");//English
				}
				else
				{
					AfxMessageBox("远程设置系统密码成功!");//Chinese
				}
			}				
			else
			{
				if(ENGLISH)
				{
					AfxMessageBox("Set System Password Failed!");//English
				}
				else
				{
					AfxMessageBox("远程设置系统密码失败!");//Chinese
				}
			}
			break;
	
		case	NETCON_REMOTE_QUERY_IN_PROBE:
		case	NETCON_REMOTE_QUERY_OUT_PROBE:
			{
				int temp=0;
				memcpy(&temp,Buf+11,2);
				RefreshIoCheck(temp);
			}
			break;
//		case NETCOM_VIDEOIN_LU_CH_CO_GETACK:
//			break;
		case NETCOM_VIDEOIN_LU_CH_CO_GETREJECT:
			if(ENGLISH)
			{
				AfxMessageBox("Get Video Parameter Failed!");//English
			}
			else
			{
				AfxMessageBox("获得视频参数失败!");//Chinese
			}			
			break;
		case NETCOM_VIDEOIN_LU_CH_CO_SETACK:
			if(ENGLISH)
			{
				AfxMessageBox("Set Video Parameter Success!");//English
			}
			else
			{
				AfxMessageBox("设置视频参数成功!");//Chinese
			}			
			break;
		case BACKING_RECFILE:
			if(ENGLISH)
			{
				m_state.Format("Backup...:%02d_%02d_%02d\\P_%02d\\%02d:%02d",Buf[9],Buf[10],Buf[11],Buf[12],Buf[13],Buf[14]);//English
			}
			else
			{
				m_state.Format("备份...:%02d_%02d_%02d\\P_%02d\\%02d:%02d",Buf[9],Buf[10],Buf[11],Buf[12],Buf[13],Buf[14]);//Chinese
			}			
			UpdateData(FALSE);
			break;
		case UPDATE_ERROR:
			switch(Buf[9])
			{
			case INVALID_NETADDR:
				if(ENGLISH)
				{
					m_state="Invalid IP Address";//English
				}
				else
				{
					m_state="无效IP地址";//Chinese
				}				
				break;
			case INVALID_FILENAME:
				if(ENGLISH)
				{
					m_state="Invalid File Name";//English
				}
				else
				{
					m_state="无效文件名";//Chinese
				}				
				break;
			case OPENFILE_FAIL:
				if(ENGLISH)
				{
					m_state="Open File Failed";//English
				}
				else
				{
					m_state="打开文件失败";//Chinese
				}				
				break;
			case CREATESOCK_FAIL:
				if(ENGLISH)
				{
					m_state="Create Socket Failed";//English
				}
				else
				{
					m_state="创建Socket失败";//Chinese
				}				
				break;
			case SETSOCKETOPT_FAIL:
				if(ENGLISH)
				{
					m_state="Set Socket Parameter Failed";//English
				}
				else
				{
					m_state="设置Socket参数失败";//Chinese
				}				
				break;
			case SOCKETLINK_FAIL:
				if(ENGLISH)
				{
					m_state="Connect Socket Timeout";//English
				}
				else
				{
					m_state="连接Socket超时";//Chinese
				}				
				break;
			case PROCESS_BREAK:
				if(ENGLISH)
				{
					m_state="Upgrade Interrupt";//English
				}
				else
				{
					m_state="升级中断";//Chinese
				}				
				break;
			case SOCKETLINK_SUCCESS:
				if(ENGLISH)
				{
					m_state="Connect Socket Success";//English
				}
				else
				{
					m_state="连接Socket成功";//Chinese
				}				
				break;
			case CREATETHREAD_FAIL:
				if(ENGLISH)
				{
					m_state="Create Download Thread Failed";//English
				}
				else
				{
					m_state="创建下载路线失败";//Chinese
				}				
				break;
			case INVALID_RATEVALUE:
				if(ENGLISH)
				{
					m_state="Invalid Rate Value";//English
				}
				else
				{
					m_state="无效波特率值";//Chinese
				}				
				break;
			case COMPORT_CLOSED:
				if(ENGLISH)
				{
					m_state="Com Had Been Closed";//English
				}
				else
				{
					m_state="串口已经关闭";//Chinese
				}				
				break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -