MatCenter.cpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. // MatCenter.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "newclient.h"
  5. #include "MatCenter.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMatCenter dialog
  13. CMatCenter::CMatCenter(CWnd* pParent /*=NULL*/)
  14. : CDialog(CMatCenter::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CMatCenter)
  17. m_Ip = _T("");
  18. m_Port = 0;
  19. m_UserName = _T("");
  20. m_UserPSW = _T("");
  21. m_Ip1 = _T("");
  22. m_Port1 = 0;
  23. m_Port2 = 0;
  24. m_UserName1 = _T("");
  25. m_UserName2 = _T("");
  26. m_UserPSW1 = _T("");
  27. m_UserPSW2 = _T("");
  28. m_CtrlMedia1 = FALSE;
  29. m_CtrlMedia2 = FALSE;
  30. m_CtrlMedia3 = FALSE;
  31. m_CtrlMedia4 = FALSE;
  32. //}}AFX_DATA_INIT
  33. }
  34. void CMatCenter::DoDataExchange(CDataExchange* pDX)
  35. {
  36. CDialog::DoDataExchange(pDX);
  37. //{{AFX_DATA_MAP(CMatCenter)
  38. DDX_Control(pDX, IDC_COMISOLATED, m_IsolatedCtrl);
  39. DDX_Control(pDX, IDC_COMPRO, m_ProCtrl);
  40. DDX_Text(pDX, IDC_EDITIP, m_Ip);
  41. DDX_Text(pDX, IDC_EDITPORT, m_Port);
  42. DDX_Text(pDX, IDC_EDITUSERNAME, m_UserName);
  43. DDX_Text(pDX, IDC_EDITUSERPSW, m_UserPSW);
  44. DDX_Text(pDX, IDC_EDITIP2, m_Ip1);
  45. DDX_Text(pDX, IDC_EDITPORT1, m_Port1);
  46. DDX_Text(pDX, IDC_EDITPORT2, m_Port2);
  47. DDX_Text(pDX, IDC_EDITUSERNAME1, m_UserName1);
  48. DDX_Text(pDX, IDC_EDITUSERNAME2, m_UserName2);
  49. DDX_Text(pDX, IDC_EDITUSERPSW1, m_UserPSW1);
  50. DDX_Text(pDX, IDC_EDITUSERPSW2, m_UserPSW2);
  51. DDX_Check(pDX, IDC_CHECK1, m_CtrlMedia1);
  52. DDX_Check(pDX, IDC_CHECK2, m_CtrlMedia2);
  53. DDX_Check(pDX, IDC_CHECK3, m_CtrlMedia3);
  54. DDX_Check(pDX, IDC_CHECK4, m_CtrlMedia4);
  55. //}}AFX_DATA_MAP
  56. }
  57. BEGIN_MESSAGE_MAP(CMatCenter, CDialog)
  58. //{{AFX_MSG_MAP(CMatCenter)
  59. ON_BN_CLICKED(IDC_BUTGET, OnButget)
  60. ON_BN_CLICKED(IDC_BUTSET, OnButset)
  61. ON_BN_CLICKED(IDC_BUTSET1, OnButset1)
  62. ON_BN_CLICKED(IDC_BUTGET2, OnButget2)
  63. ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
  64. //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CMatCenter message handlers
  68. BOOL CMatCenter::OnInitDialog()
  69. {
  70. CDialog::OnInitDialog();
  71. // TODO: Add extra initialization here
  72. m_ProCtrl.SetCurSel(0);
  73. m_IsolatedCtrl.SetCurSel(0);
  74. return TRUE; // return TRUE unless you set the focus to a control
  75. // EXCEPTION: OCX Property Pages should return FALSE
  76. }
  77. void CMatCenter::OnCancel()
  78. {
  79. // TODO: Add extra cleanup here
  80. // CDialog::OnCancel();
  81. }
  82. void CMatCenter::OnOK()
  83. {
  84. // TODO: Add extra validation here
  85. // CDialog::OnOK();
  86. }
  87. void CMatCenter::OnButget()
  88. {
  89. // TODO: Add your control notification handler code here
  90. /*
  91. NET_DVR_MATRIX_CENTER stru;
  92. if (!NET_DVR_MatrixGetCenter(m_lServerID, &stru))
  93. {
  94. CString sTemp;
  95. sTemp.Format("ERROR: NET_DVR_MatrixGetCenter = %d \n", NET_DVR_GetLastError());
  96. TRACE(sTemp);
  97. // return FALSE;
  98. }
  99. m_Port = stru.MatrixCenterPort;
  100. m_Ip = stru.sMatrixCenterIP;
  101. m_UserPSW = stru.sPasswd;
  102. m_UserName = stru.sUsrName;
  103. UpdateData(FALSE);
  104. */
  105. }
  106. void CMatCenter::OnButset()
  107. {
  108. // TODO: Add your control notification handler code here
  109. /*
  110. UpdateData(TRUE);
  111. NET_DVR_MATRIX_CENTER stru;
  112. stru.dwSize = sizeof(NET_DVR_MATRIX_CENTER);
  113. stru.MatrixCenterPort = m_Port;
  114. memcpy(stru.sMatrixCenterIP, m_Ip, 16);
  115. memcpy(stru.sPasswd, m_UserPSW, PASSWD_LEN);
  116. memcpy(stru.sUsrName, m_UserName, NAME_LEN);
  117. if (!NET_DVR_MatrixSetCenter(m_lServerID, &stru))
  118. {
  119. CString sTemp;
  120. sTemp.Format("ERROR: NET_DVR_MatrixSetCenter = %d \n", NET_DVR_GetLastError());
  121. TRACE(sTemp);
  122. // return FALSE;
  123. }
  124. */
  125. }
  126. void CMatCenter::OnButset1()
  127. {
  128. // TODO: Add your control notification handler code here
  129. UpdateData(TRUE);
  130. // NET_DVR_MATRIX_LOCAL_HOST_INFO stru;
  131. // stru.dwSize = sizeof(NET_DVR_MATRIX_LOCAL_HOST_INFO);
  132. // stru.dwLocalHostProperty = m_ProCtrl.GetCurSel();
  133. // stru.dwIsIsolated = m_IsolatedCtrl.GetCurSel();
  134. // stru.dwLocalMatrixHostPort = m_Port1;
  135. // memcpy(stru.byLocalMatrixHostPasswd, m_UserPSW1, PASSWD_LEN);
  136. // memcpy(stru.byLocalMatrixHostUsrName, m_UserName1, NAME_LEN);
  137. // stru.dwLocalMatrixCtrlMedia = 0x00;
  138. // if (m_CtrlMedia1)
  139. // {
  140. // stru.dwLocalMatrixCtrlMedia |= 0x01;
  141. // }
  142. // if (m_CtrlMedia2)
  143. // {
  144. // stru.dwLocalMatrixCtrlMedia |= 0x02;
  145. // }
  146. // if (m_CtrlMedia3)
  147. // {
  148. // stru.dwLocalMatrixCtrlMedia |= 0x04;
  149. // }
  150. // if (m_CtrlMedia4)
  151. // {
  152. // stru.dwLocalMatrixCtrlMedia |= 0x08;
  153. // }
  154. // stru.dwMatrixCenterPort = m_Port2;
  155. // memcpy(stru.sMatrixCenterIP, m_Ip1, 16);
  156. // memcpy(stru.byMatrixCenterPasswd, m_UserPSW2, PASSWD_LEN);
  157. // memcpy(stru.byMatrixCenterUsrName, m_UserName2, NAME_LEN);
  158. // if (!NET_DVR_MatrixSetLocalHost(m_lServerID, &stru))
  159. // {
  160. // CString sTemp;
  161. // sTemp.Format("ERROR: NET_DVR_MatrixSetLocalHost = %d \n", NET_DVR_GetLastError());
  162. // AfxMessageBox(sTemp);
  163. // return;
  164. // }
  165. // MessageBox("ÉèÖóɹ¦!");
  166. }
  167. void CMatCenter::OnButget2()
  168. {
  169. // TODO: Add your control notification handler code here
  170. // NET_DVR_MATRIX_LOCAL_HOST_INFO stru;
  171. // if (!NET_DVR_MatrixGetLocalHost(m_lServerID, &stru))
  172. // {
  173. // CString sTemp;
  174. // sTemp.Format("ERROR: NET_DVR_MatrixGetLocalHost = %d \n", NET_DVR_GetLastError());
  175. // AfxMessageBox(sTemp);
  176. // }
  177. // else
  178. // {
  179. // m_ProCtrl.SetCurSel(stru.dwLocalHostProperty);
  180. // m_IsolatedCtrl.SetCurSel(stru.dwIsIsolated);
  181. // m_Port1 = stru.dwLocalMatrixHostPort;
  182. // m_UserPSW1 = stru.byLocalMatrixHostPasswd;
  183. // m_UserName1 = stru.byLocalMatrixHostUsrName;
  184. // //m_CtrlMedia = stru.dwLocalMatrixCtrlMedia;
  185. // m_CtrlMedia1 = stru.dwLocalMatrixCtrlMedia & 0x01;
  186. // m_CtrlMedia2 = (stru.dwLocalMatrixCtrlMedia & 0x02)>>1;
  187. // m_CtrlMedia3 = (stru.dwLocalMatrixCtrlMedia & 0x04)>>2;
  188. // m_CtrlMedia4 = (stru.dwLocalMatrixCtrlMedia & 0x08)>>3;
  189. // m_Port2 = stru.dwMatrixCenterPort;
  190. // m_Ip1 = stru.sMatrixCenterIP;
  191. // m_UserPSW2 = stru.byMatrixCenterPasswd;
  192. // m_UserName2 = stru.byMatrixCenterUsrName;
  193. // }
  194. //
  195. // UpdateData(FALSE);
  196. }
  197. void CMatCenter::OnButexit()
  198. {
  199. // TODO: Add your control notification handler code here
  200. CDialog::OnOK();
  201. }