123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- // ExceptionCFG.cpp : implementation file
- //
- #include "stdafx.h"
- #include "StoneU_HC_OCX.h"
- #include "ExceptionCFG.h"
- #include "RemoteParamsCfg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CExceptionCFG dialog
- extern CRemoteParamsCfg *m_pRemoteParam;
- CExceptionCFG::CExceptionCFG(CWnd* pParent /*=NULL*/)
- : CDialog(CExceptionCFG::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CExceptionCFG)
- m_bHandleType1 = FALSE;
- m_bHandleType2 = FALSE;
- m_bHandleType3 = FALSE;
- m_bHandleType4 = FALSE;
- m_bAlarmOut1 = FALSE;
- m_bAlarmOut2 = FALSE;
- m_bAlarmOut3 = FALSE;
- m_bAlarmOut4 = FALSE;
- //}}AFX_DATA_INIT
- }
- void CExceptionCFG::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CExceptionCFG)
- DDX_Control(pDX, IDC_COMEXCEPTION, m_ExceptionCtrl);
- DDX_Check(pDX, IDC_CHECKHANDLETYPE1, m_bHandleType1);
- DDX_Check(pDX, IDC_CHECKHANDLETYPE2, m_bHandleType2);
- DDX_Check(pDX, IDC_CHECKHANDLETYPE3, m_bHandleType3);
- DDX_Check(pDX, IDC_CHECKHANDLETYPE4, m_bHandleType4);
- DDX_Check(pDX, IDC_CHKALARMOUT1, m_bAlarmOut1);
- DDX_Check(pDX, IDC_CHKALARMOUT2, m_bAlarmOut2);
- DDX_Check(pDX, IDC_CHKALARMOUT3, m_bAlarmOut3);
- DDX_Check(pDX, IDC_CHKALARMOUT4, m_bAlarmOut4);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CExceptionCFG, CDialog)
- //{{AFX_MSG_MAP(CExceptionCFG)
- ON_BN_CLICKED(IDC_BUTOK, OnButok)
- ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
- ON_BN_CLICKED(IDC_CHECKHANDLETYPE4, OnCheckhandletype4)
- ON_CBN_SELCHANGE(IDC_COMEXCEPTION, OnSelchangeComexception)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CExceptionCFG message handlers
- BOOL CExceptionCFG::CheckPara()
- {
- DWORD dwReturned;
- CString sTemp;
- m_SelType = 0;
- m_ExceptionCtrl.SetCurSel(m_SelType);
- if (m_bConnectServer)
- {
- if (!NET_DVR_GetDVRConfig(m_lServerID, NET_DVR_GET_EXCEPTIONCFG, 0,&m_ExceptionInfo, sizeof(NET_DVR_EXCEPTION), &dwReturned))
- {
- sTemp.Format("ERROR: NET_DVR_GET_EXCEPTIONCFG = %d \n", NET_DVR_GetLastError());
- MessageBox(sTemp, "ÎÂܰÌáʾ", MB_ICONINFORMATION);
- }
- else
- {
- m_bHandleType1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType &0x01;
- m_bHandleType2 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>1)&0x01;
- m_bHandleType3 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>2)&0x01;
- m_bHandleType4 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>3)&0x01;
- EnableControl(m_bHandleType4);
- }
- }
- UpdateData(FALSE);
- return TRUE;
- }
- BOOL CExceptionCFG::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- CRect rc(0, 0, 0, 0);
- GetParent()->GetClientRect(&rc);
- ((CTabCtrl*)GetParent())->AdjustRect(FALSE, &rc);
- MoveWindow(&rc);
-
- if(m_pRemoteParam->m_dvrSelect != -1)
- CheckPara();
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CExceptionCFG::OnCancel()
- {
- // TODO: Add extra cleanup here
-
- // CDialog::OnCancel();
- }
- void CExceptionCFG::OnOK()
- {
- // TODO: Add extra validation here
-
- // CDialog::OnOK();
- }
- void CExceptionCFG::OnButok()
- {
- if(m_pRemoteParam->m_dvrSelect == -1)
- return;
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- m_SelType = m_ExceptionCtrl.GetCurSel();
- m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType = 0;
- m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType1 << 0);
- m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType2 << 1);
- m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType3 << 2);
- m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType4 << 3);
- m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[0] = m_bAlarmOut1;
- m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[1] = m_bAlarmOut2;
- m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[2] = m_bAlarmOut3;
- m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[3] = m_bAlarmOut4;
-
- m_bSetPara = TRUE;
- }
- void CExceptionCFG::OnButexit()
- {
- // TODO: Add your control notification handler code here
- m_bSetPara = FALSE;
- }
- void CExceptionCFG::OnCheckhandletype4()
- {
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- EnableControl(m_bHandleType4);
- }
- void CExceptionCFG::OnSelchangeComexception()
- {
- if(m_pRemoteParam->m_dvrSelect == -1)
- return;
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- m_SelType = m_ExceptionCtrl.GetCurSel();
- m_bHandleType1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType &0x01;
- m_bHandleType2 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>1)&0x01;
- m_bHandleType3 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>2)&0x01;
- m_bHandleType4 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>3)&0x01;
- EnableControl(m_bHandleType4);
-
- UpdateData(FALSE);
- }
- void CExceptionCFG::EnableControl(BOOL bEnable)
- {
- if (m_dwAlarmOutNum >= 1)
- {
- GetDlgItem(IDC_CHKALARMOUT1)->EnableWindow(bEnable);
- m_bAlarmOut1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[0];
- }
- if (m_dwAlarmOutNum >= 2)
- {
- GetDlgItem(IDC_CHKALARMOUT2)->EnableWindow(bEnable);
- m_bAlarmOut2 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[1];
- }
- if (m_dwAlarmOutNum >= 3)
- {
- GetDlgItem(IDC_CHKALARMOUT3)->EnableWindow(bEnable);
- m_bAlarmOut3 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[2];
- }
- if (m_dwAlarmOutNum >= 4)
- {
- GetDlgItem(IDC_CHKALARMOUT4)->EnableWindow(bEnable);
- m_bAlarmOut4 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[3];
- }
- }
|