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

📄 sampledlg.cpp

📁 TM8000硬盘录像机客户端编程文档和Demo源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			case COMPORTCONNECT_FAIL:
				if(ENGLISH)
				{
					m_state="Connect Com Failed";//English
				}
				else
				{
					m_state="连接串口失败";//Chinese
				}				
				break;
			case COMPORTCONNECT_SUCCESS:
				if(ENGLISH)
				{
					m_state="Connect Com Success";//English
				}
				else
				{
					m_state="连接串口成功";//Chinese
				}
				break;
			case DOWNLOADFILE_FAIL:
				if(ENGLISH)
				{
					m_state="Download Failed";//English
				}
				else
				{
					m_state="下载失败";//Chinese
				}				
				break;
			case DOWNLOAD_SUCCESS:
				if(ENGLISH)
				{
					m_state="Download Success";//English
				}
				else
				{
					m_state="下载成功";//Chinese
				}				
				break;
				
			case DELETING_PROG:
				if(ENGLISH)
				{
					m_state="Be Deleting Program";//English
				}
				else
				{
					m_state="正在删除程序";//Chinese
				}				
				break;
			case USER_CANCELED:
				if(ENGLISH)
				{
					m_state="Upgrade Canceled";//English
				}
				else
				{
					m_state="升级失败";//Chinese
				}				
				break;
			}
			UpdateData(FALSE);
			break;
		case DOWNLOAD_PROGRESS:
			if(Buf[9]==0)
				m_state.Format("Downloading MASTER:%d%%",Buf[10]);
			else if(Buf[9]==1)
				m_state.Format("Downloading SLAVE:%d%%",Buf[10]);
			UpdateData(FALSE);
			break;
		case UPDATE_PROGRESS:
			switch(Buf[9])
			{
			case UPDATE_WAIT:
				if(ENGLISH)
				{
					m_state="Please Wait A Moment";//English
				}
				else
				{
					m_state="请等待";//Chinese
				}				
				break;
			case UPDATE_POS:
				m_state.Format("Upgrading MASTER:%d%%,SLAVE:%d%%",Buf[10],Buf[11]);
				break;
			}
			UpdateData(FALSE);
			break;
		case UPDATE_SUCCESS:
			if(ENGLISH)
			{
				m_state="Upgrade Success";//English
			}
			else
			{
				m_state="升级成功";//Chinese
			}			
			UpdateData(FALSE);
			break;
		case REMOTE_UPDATE_SUCCESS:
			if(ENGLISH)
			{
				m_state="Server Had Received Upgrade Command,Please Upgrade Later";//English
			}
			else
			{
				m_state="主机已经接收到升级命令,请稍候";//Chinese
			}			
			UpdateData(FALSE);
			break;
		case TALK_DVR_STATUS:
			if(Buf[9]>=0)
				pTalkMan->SetTalkState(nIpAddr,Buf[9]);
			else
			{
				if(ENGLISH)
				{
					m_state="Initial Talk Failed";//English
				}
				else
				{
					m_state="初始化对讲失败";//Chinese
				}	
			   UpdateData(FALSE);
			}
			break;
		case NETCOM_LOGIN_FAIL:
			if(Buf[9]==1)
			{
				if(ENGLISH)
				{
					AfxMessageBox("User Name Or Password Error!");//English
				}
				else
				{
					AfxMessageBox("用户名或密码错误!");//Chinese
				}
			}				
			else if(Buf[9]==2)
			{
				if(ENGLISH)
				{
					AfxMessageBox("The Server Had't Been Logined!");//English
				}
				else
				{
					AfxMessageBox("主机还没有登录!");//Chinese
				}
			}				
			break;
		case NETCOM_CTRL_READLOG_ACK:
			strcat(logBuf,Buf+9);
			str.Format("%s",logBuf);
			TRACE("loglen=%d\n",strlen(logBuf));
			if((str.Find("ENDSENDING",0)) == -1)
			{
				isContinue = 1;
				break;
			}
			else
			{
				pNetRemoteCtlDlg->SetLog(str);
				
				memset(logBuf,0,64*1024);
				str = "";
				break;
			}
			if(isContinue)
			{
				strcat(logBuf,Buf+1);
				str.Format("%s",logBuf);
				if((str.Find("ENDSENDING",0)) != -1)
				{
					isContinue = 0;
					pNetRemoteCtlDlg->SetLog(str);
					memset(logBuf,0,64*1024);
					str = "";
				}
			}
			break;
		case NETCOM_CTRL_DVRSTATE_ACK:
			str1="";
			str2="";
			memcpy(&wChannelMask, Buf+10,2); 
			switch(Buf[9])
			{
			case REC_STATE:
				if(ENGLISH)
				{
					str2="Channel";//English
				}
				else
				{
					str2="通道";//Chinese
				}				
				for(i=1,j=1;
				i<=(pNetRemoteCtlDlg->m_nDVRType <=0?Con_pDVRPara->nPortNo:m_LoginParam.ChannelCount);
				i++,j*=2)
				{
					if(wChannelMask&j)
					{
						str1.Format("%d",i);
						str2+=str1;
						str2+=",";
						
					}
				}
				if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English 
				{
					str2=str2.Left(str2.GetLength()-1);									
					if(ENGLISH)
					{
						str2+="Recording";//English
					}
					else
					{
						str2+="正在录像";//Chinese
					}
					AfxMessageBox(str2);
				}
				
				else
				{
					if(ENGLISH)
					{
						AfxMessageBox("No Record");//English
					}
					else
					{
						AfxMessageBox("没有录像");//Chinese
					}						
				}
				
				break;
			case VIDEO_LOST_ALARM_STATE:		
				if(ENGLISH)
				{
					str2="channel";//English
				}
				else
				{
					str2="通道";//Chinese
				}
				
				for(i=1,j=1;
				i<=(pNetRemoteCtlDlg->m_nDVRType <=0?Con_pDVRPara->nPortNo:m_LoginParam.ChannelCount);
				i++,j*=2)
				{
					if(wChannelMask&j)
					{
						str1.Format("%d",i);
						str2+=str1;
						str2+=",";
						
					}
				}
				if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English
				{
					str2=str2.Left(str2.GetLength()-1);						
					if(ENGLISH)
					{
						str2+="Video Lost";//English
					}
					else
					{
						str2+="视频丢失";//Chinese
					}
					AfxMessageBox(str2);
				}
				else
				{
					if(ENGLISH)
					{
						AfxMessageBox("No Video Lost");//English
					}
					else
					{
						AfxMessageBox("无视频丢失");//Chinese
					}						
				}							
				break;
			case VIDEO_MOVE_ALARM_STATE:					
				if(ENGLISH)
				{
					str2="Channel";//English
				}
				else
				{
					str2="通道";//Chinese
				}
				for(i=1,j=1;
				i<=(pNetRemoteCtlDlg->m_nDVRType <=0?Con_pDVRPara->nPortNo:m_LoginParam.ChannelCount);
				i++,j*=2)
				{
					if(wChannelMask&j)
					{
						str1.Format("%d",i);
						str2+=str1;
						str2+=",";
						
					}
				}
				if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English
				{
					str2=str2.Left(str2.GetLength()-1);
					if(ENGLISH)
					{
						str2+="Move Alarm";//English
					}
					else
					{
						str2+="移动报警";//Chinese
					}						
					AfxMessageBox(str2);
				}
				else
				{
					if(ENGLISH)
					{
						AfxMessageBox("No Move Alarm");//English
					}
					else
					{
						AfxMessageBox("无移动报警");//Chinese
					}						
				}				
				break;
			case SENSOR_ALARM_STETE:				
				if(ENGLISH)
				{
					str2="Channel";//English
				}
				else
				{
					str2="通道";//Chinese
				}
				memcpy(&wSens,Buf+10,2);				
				
				for(i=1,j=1;
				i<=16;
				//i<=(pNetRemoteCtlDlg->m_nDVRType<=0?Con_pDVRPara->nPortNo:m_LoginParam.ChannelCount);
				i++,j*=2)
				{
					if(wSens&j)
					{
						str1.Format("%d",i);
						str2+=str1;
						str2+=",";
						
					}
				}
				if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English
				{
					str2=str2.Left(str2.GetLength()-1);						
					if(ENGLISH)
					{
						str2+="Probe Alarm";//English
					}
					else
					{
						str2+="探头报警";//Chinese
					}
					AfxMessageBox(str2);
				}
				else
				{
					if(ENGLISH)
					{
						AfxMessageBox("No Probe Alarm");//English
					}
					else
					{
						AfxMessageBox("无探头报警");//Chinese
					}						
				}				
				break;
            case VIDEO_ENVELOP_ALARM_STATE:
				if(ENGLISH)
				{
					str2="Channel";//English
				}
				else
				{
					str2="通道";//Chinese
				}				
				if (pNetRemoteCtlDlg->m_nDVRType <= 0) 
				{
					for(i=1,j=1;i<=Con_pDVRPara->nPortNo;i++,j*=2)
					{
						if(wChannelMask&j)
						{
							str1.Format("%d",i);
							str2+=str1;
							str2+=",";
							
						}
					}
					if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English 
					{
						str2=str2.Left(str2.GetLength()-1);
						if(ENGLISH)
						{
							str2+="Cover Alarm";//English
						}
						else
						{
							str2+="遮挡报警";//Chinese
						}						
						AfxMessageBox(str2);
					}
					else
					{
						if(ENGLISH)
						{
							str2+="No Cover Alarm";//English
						}
						else
						{
							str2+="无遮挡报警";//Chinese
						}						
					}
				}
				else
				{
					for(i=1,j=1;i<=m_LoginParam.ChannelCount;i++,j*=2)
					{
						if(wChannelMask&j)
						{
							str1.Format("%d",i);
							str2+=str1;
							str2+=",";
							
						}
					}
					if(str2.GetLength()>5)//Chinese
					//if(str2.GetLength()>7)//English
					{
						str2=str2.Left(str2.GetLength()-1);
						
						if(ENGLISH)
						{
							str2+="Cover Alarm";//English
						}
						else
						{
							str2+="遮挡报警";//Chinese
						}
						AfxMessageBox(str2);
					}
					else
					{
						if(ENGLISH)
						{
							str2+="No Cover Alarm";//English
						}
						else
						{
							str2+="无遮挡报警";//Chinese
						}					
					}
				}
				break;
			case HARDDISK_STATE:
				m_DiskInfo.ResetContent();				
				if(ENGLISH)
				{
					m_DiskInfo.AddString("Harddisk Data");//English
				}
				else
				{
					m_DiskInfo.AddString("硬盘数据");//Chinese
				}
				nDiskNo=(int)Buf[10];
				if(ENGLISH)
				{
					str2.Format("Harddisk Count: %d",nDiskNo);//English
				}
				else
				{
					str2.Format("硬盘数: %d",nDiskNo);//Chinese
				}
				m_DiskInfo.AddString(str2);
				memcpy(&DiskSpace,Buf+11,4);
				if(ENGLISH)
				{
					str2.Format("Total Content: %d MB",DiskSpace);//English
				}
				else
				{
					str2.Format("总大小: %d MB",DiskSpace);//Chinese
				}				
				m_DiskInfo.AddString(str2);
				memcpy(&FreeDisk,Buf+15,4);
				if(ENGLISH)
				{
					str2.Format("Left Content: %d MB",FreeDisk);//English
				}
				else
				{
					str2.Format("空闲大小: %d MB",FreeDisk);//Chinese
				}				
				m_DiskInfo.AddString(str2);
				for(i=1;i<=nDiskNo;i++)
				{					
					if(ENGLISH)
					{
						str2.Format("Harddisk %d:",i);//English
					}
					else
					{
						str2.Format("硬盘 %d:",i);//Chinese
					}
					m_DiskInfo.AddString(str2);
					if(Buf[i+18]&1)
					{
						if(ENGLISH)
						{
							str2="Have not Partitioned Or Formated;";//English
						}
						else
						{
							str2="还没有分区或格式化";//Chinese
						}						
					}
					else
					{
						if(ENGLISH)
						{
							str2="Had Partitioned And Formated;";//English
						}
						else
						{
							str2="已经分区和格式化;";//Chinese
						}
						
					}
					m_DiskInfo.AddString(str2);
					if(Buf[i+18]&2)
					{
						if(ENGLISH)
						{

⌨️ 快捷键说明

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