📄 matdecchanstatus.cpp
字号:
// MatDecChanStatus.cpp : implementation file
//
/************************************************************************/
/* CopyRights 2007-2008
FileName: MatDecChanStatus.cpp
Description: set up multi-decoder
Author: sym
Date: 2007-11-10
Modification History:
<version> <time> <author> <desc>
2.1.11.10 2007-11-10 sym create new file, add new functions */
/************************************************************************/
#include "stdafx.h"
#include "newclient.h"
#include "MatDecChanStatus.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMatDecChanStatus dialog
extern void g_IPToStr(DWORD dip, char outbuf[16]);
CMatDecChanStatus::CMatDecChanStatus(CWnd* pParent /*=NULL*/)
: CDialog(CMatDecChanStatus::IDD, pParent)
{
//{{AFX_DATA_INIT(CMatDecChanStatus)
m_InfoChanNum = 0;
m_InfoFileName = _T("");
m_InfoSurIP = _T("");
m_InfoSurPass = _T("");
m_InfoSurPort = 0;
m_InfoSurUser = _T("");
m_CopyRate = 0;
//}}AFX_DATA_INIT
}
void CMatDecChanStatus::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMatDecChanStatus)
DDX_Control(pDX, IDC_COMBOLINKSTATE, m_LinkState);
DDX_Control(pDX, IDC_COMBODECCHANSTATE, m_InfoDecState);
DDX_Control(pDX, IDC_DATETIMEPICKER4, m_InfoStopTime);
DDX_Control(pDX, IDC_DATETIMEPICKER3, m_InfoStopDate);
DDX_Control(pDX, IDC_DATETIMEPICKER2, m_InfoStartTime);
DDX_Control(pDX, IDC_DATETIMEPICKER1, m_InfoStartDate);
DDX_Control(pDX, IDC_COMBOINFOPROTOCOL, m_InfoProtocolCombo);
DDX_Control(pDX, IDC_COMBOINFOMODE, m_InfoTransModeCombo);
DDX_Control(pDX, IDC_COMBOINFOCHAN, m_InfoDecChanCombo);
DDX_Text(pDX, IDC_EDITINFOCHANNO, m_InfoChanNum);
DDX_Text(pDX, IDC_EDITINFOFILENAME, m_InfoFileName);
DDX_Text(pDX, IDC_EDITINFOIP, m_InfoSurIP);
DDX_Text(pDX, IDC_EDITINFOPASS, m_InfoSurPass);
DDX_Text(pDX, IDC_EDITINFOPORT, m_InfoSurPort);
DDX_Text(pDX, IDC_EDITINFOUSER, m_InfoSurUser);
DDX_Text(pDX, IDC_EDITCOPYRATE, m_CopyRate);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMatDecChanStatus, CDialog)
//{{AFX_MSG_MAP(CMatDecChanStatus)
ON_CBN_SELCHANGE(IDC_COMBOINFOCHAN, OnSelchangeComboinfochan)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMatDecChanStatus message handlers
BOOL CMatDecChanStatus::OnInitDialog()
{
CDialog::OnInitDialog();
m_vGetStatus.resize(m_iChannelnumber);
m_vGetInfo.resize(m_iChannelnumber);
// TODO: Add extra initialization here
CString tmp;
for (int i=0; i<m_iChannelnumber; i++)
{
tmp.Format("%d", i+m_lStartChan);
m_InfoDecChanCombo.AddString(tmp);
//get every channel statuses and infos
ZeroMemory(&m_MatrixInfo[i], sizeof(m_MatrixInfo[i]));
m_MatrixInfo[i].dwSize = sizeof(m_MatrixInfo[i]);
if (NET_DVR_MatrixGetDecChanInfo(m_lServerID, i+m_lStartChan, &m_MatrixInfo[i]))
{
m_vGetInfo[i] = TRUE;
}
else
{
tmp.Format("%d Error: NET_DVR_MatrixGetDecChanInfo = %d\n", i+m_lStartChan, NET_DVR_GetLastError());
AfxMessageBox(tmp);
m_vGetInfo[i] = FALSE;
}
ZeroMemory(&m_MatrixStatus[i], sizeof(m_MatrixStatus[i]));
m_MatrixStatus[i].dwSize = sizeof(m_MatrixStatus[i]);
if (NET_DVR_MatrixGetDecChanStatus(m_lServerID, i+m_lStartChan, &m_MatrixStatus[i]))
{
m_vGetStatus[i] = TRUE;
}
else
{
tmp.Format("%d Error: NET_DVR_MatrixGetDecChanStatus = %d\n", i+m_lStartChan, NET_DVR_GetLastError());
AfxMessageBox(tmp);
m_vGetStatus[i] = FALSE;
}
}
for (i=0; i<m_iChannelnumber; i++)
{
if (m_vGetInfo[i])
{
//choose a channel which get info success to display
m_InfoDecChanCombo.SetCurSel(i);
m_InfoDecState.SetCurSel(m_MatrixInfo[i].dwDecState);
m_InfoSurIP.Format("%s", m_MatrixInfo[i].struDecChanInfo.sDVRIP);
m_InfoSurPort = m_MatrixInfo[i].struDecChanInfo.wDVRPort;
m_InfoSurUser.Format("%s", m_MatrixInfo[i].struDecChanInfo.sUserName);
m_InfoSurPass.Format("%s", m_MatrixInfo[i].struDecChanInfo.sPassword);
m_InfoChanNum = m_MatrixInfo[i].struDecChanInfo.byChannel;
m_InfoProtocolCombo.SetCurSel(m_MatrixInfo[i].struDecChanInfo.byTransProtocol);
m_InfoTransModeCombo.SetCurSel(m_MatrixInfo[i].struDecChanInfo.byTransMode);
if (m_MatrixInfo[i].struDecChanInfo.byTransMode == 3)
{
SYSTEMTIME st;
st.wYear = m_MatrixInfo[i].StartTime.dwYear;
st.wMonth = m_MatrixInfo[i].StartTime.dwMonth;
st.wDay = m_MatrixInfo[i].StartTime.dwDay;
st.wHour = m_MatrixInfo[i].StartTime.dwHour;
st.wMinute = m_MatrixInfo[i].StartTime.dwMinute;
st.wSecond = m_MatrixInfo[i].StartTime.dwSecond;
m_InfoStartDate.SetTime(&st);
m_InfoStartTime.SetTime(&st);
st.wYear = m_MatrixInfo[i].StopTime.dwYear;
st.wMonth = m_MatrixInfo[i].StopTime.dwMonth;
st.wDay = m_MatrixInfo[i].StopTime.dwDay;
st.wHour = m_MatrixInfo[i].StopTime.dwHour;
st.wMinute = m_MatrixInfo[i].StopTime.dwMinute;
st.wSecond = m_MatrixInfo[i].StopTime.dwSecond;
m_InfoStopDate.SetTime(&st);
m_InfoStopTime.SetTime(&st);
}
else if (m_MatrixInfo[i].struDecChanInfo.byTransMode == 2)
{
m_InfoFileName.Format("%s", m_MatrixInfo[i].sFileName);
}
//display its status if it's been got
if (!m_vGetStatus[i])
{
tmp.Format("didn't get status of channel %d", i+m_lStartChan);
AfxMessageBox(tmp);
}
else
{
m_LinkState.SetCurSel(m_MatrixStatus[i].dwIsLinked);
m_CopyRate = m_MatrixStatus[i].dwStreamCpRate;
}
break;
}
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//display infos when channel is changed in the list
void CMatDecChanStatus::OnSelchangeComboinfochan()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
int sel = m_InfoDecChanCombo.GetCurSel();
CString tmp;
if (!m_vGetInfo[sel])
{
tmp.Format("Error: %d channel info didn't get!\n", sel+m_lStartChan);
AfxMessageBox(tmp);
return;
}
m_InfoSurIP.Format("%s", m_MatrixInfo[sel].struDecChanInfo.sDVRIP);
m_InfoSurPort = m_MatrixInfo[sel].struDecChanInfo.wDVRPort;
m_InfoSurUser.Format("%s", m_MatrixInfo[sel].struDecChanInfo.sUserName);
m_InfoSurPass.Format("%s", m_MatrixInfo[sel].struDecChanInfo.sPassword);
m_InfoChanNum = m_MatrixInfo[sel].struDecChanInfo.byChannel;
m_InfoProtocolCombo.SetCurSel(m_MatrixInfo[sel].struDecChanInfo.byTransProtocol);
m_InfoTransModeCombo.SetCurSel(m_MatrixInfo[sel].struDecChanInfo.byTransMode);
m_InfoDecState.SetCurSel(m_MatrixInfo[sel].dwDecState);
if (m_MatrixInfo[sel].struDecChanInfo.byTransMode == 3)
{
SYSTEMTIME st;
st.wYear = m_MatrixInfo[sel].StartTime.dwYear;
st.wMonth = m_MatrixInfo[sel].StartTime.dwMonth;
st.wDay = m_MatrixInfo[sel].StartTime.dwDay;
st.wHour = m_MatrixInfo[sel].StartTime.dwHour;
st.wMinute = m_MatrixInfo[sel].StartTime.dwMinute;
st.wSecond = m_MatrixInfo[sel].StartTime.dwSecond;
m_InfoStartDate.SetTime(&st);
m_InfoStartTime.SetTime(&st);
st.wYear = m_MatrixInfo[sel].StopTime.dwYear;
st.wMonth = m_MatrixInfo[sel].StopTime.dwMonth;
st.wDay = m_MatrixInfo[sel].StopTime.dwDay;
st.wHour = m_MatrixInfo[sel].StopTime.dwHour;
st.wMinute = m_MatrixInfo[sel].StopTime.dwMinute;
st.wSecond = m_MatrixInfo[sel].StopTime.dwSecond;
m_InfoStopDate.SetTime(&st);
m_InfoStopTime.SetTime(&st);
}
else if (m_MatrixInfo[sel].struDecChanInfo.byTransMode == 2)
{
m_InfoFileName.Format("%s", m_MatrixInfo[sel].sFileName);
}
//display its status if it's been got
if (!m_vGetStatus[sel])
{
tmp.Format("Error: %d channel status didn't get!\n", sel+m_lStartChan);
AfxMessageBox(tmp);
return;
}
m_LinkState.SetCurSel(m_MatrixStatus[sel].dwIsLinked);
m_CopyRate = m_MatrixStatus[sel].dwStreamCpRate;
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -