DecCfg.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. // DecCfg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "DecCfg.h"
  6. #include "DecStatus.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CDecCfg dialog
  14. CDecCfg::CDecCfg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CDecCfg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CDecCfg)
  18. m_bChk = FALSE;
  19. m_Ip = _T("");
  20. m_Port = 0;
  21. m_UserName = _T("");
  22. m_Psw = _T("");
  23. m_bChkTrans = FALSE;
  24. m_UserName1 = _T("");
  25. m_Psw1 = _T("");
  26. m_Ip2 = _T("");
  27. m_Ip1 = _T("");
  28. m_Port2 = 0;
  29. m_Port1 = 0;
  30. m_filename = _T("");
  31. m_Ip3 = _T("");
  32. m_Port3 = 0;
  33. m_ctDateStart = 0;
  34. m_ctDateStop = 0;
  35. m_ctTimeStart = 0;
  36. m_ctTimeStop = 0;
  37. m_UserName2 = _T("");
  38. m_Psw2 = _T("");
  39. //}}AFX_DATA_INIT
  40. }
  41. void CDecCfg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CDecCfg)
  45. DDX_Control(pDX, IDC_COMBOPROTYPE1, m_ProTypeCtrl1);
  46. DDX_Control(pDX, IDC_COMBOPROTYPE, m_ProTypeCtrl);
  47. DDX_Control(pDX, IDC_COMCTRL, m_ctrl);
  48. DDX_Control(pDX, IDC_COMCHAN3, m_ChanCtrl2);
  49. DDX_Control(pDX, IDC_COMBOTYPE, m_typeCtrl);
  50. DDX_Control(pDX, IDC_COMCHAN2, m_ChanCtrl1);
  51. DDX_Control(pDX, IDC_COMBOSPECNO, m_specnoctrl);
  52. DDX_Control(pDX, IDC_COMBOPROTOCOL2, m_ProtCtrl1);
  53. DDX_Control(pDX, IDC_COMBODVRTRANS, m_DVRTransCtrl);
  54. DDX_Control(pDX, IDC_COMBO1, m_transctrl);
  55. DDX_Control(pDX, IDC_COMCHAN, m_ChanCtrl);
  56. DDX_Control(pDX, IDC_COMBOTIME, m_TimeCtrl);
  57. DDX_Control(pDX, IDC_COMBOPROTOCOL, m_ProtCtrl);
  58. DDX_Control(pDX, IDC_COMBONUM, m_NumCtrl);
  59. DDX_Control(pDX, IDC_COMBONO, m_NoCtrl);
  60. DDX_Control(pDX, IDC_COMBODECNUM, m_DecNumCtrl);
  61. DDX_Control(pDX, IDC_COMBODECNO, m_DecNoCtrl);
  62. DDX_Check(pDX, IDC_CHECK1, m_bChk);
  63. DDX_Text(pDX, IDC_EDITIP, m_Ip);
  64. DDX_Text(pDX, IDC_EDITPORT, m_Port);
  65. DDX_Text(pDX, IDC_EDITUSERNAME, m_UserName);
  66. DDX_Text(pDX, IDC_EDITUSERPSW, m_Psw);
  67. DDX_Check(pDX, IDC_CHKTRANS, m_bChkTrans);
  68. DDX_Text(pDX, IDC_EDITUSERNAME2, m_UserName1);
  69. DDX_Text(pDX, IDC_EDITUSERPSW2, m_Psw1);
  70. DDX_Text(pDX, IDC_EDITIP2, m_Ip2);
  71. DDX_Text(pDX, IDC_EDITIP3, m_Ip1);
  72. DDX_Text(pDX, IDC_EDITPORT2, m_Port2);
  73. DDX_Text(pDX, IDC_EDITPORT3, m_Port1);
  74. DDX_Text(pDX, IDC_EDITFILENAME, m_filename);
  75. DDX_Text(pDX, IDC_EDITIP4, m_Ip3);
  76. DDX_Text(pDX, IDC_EDITPORT4, m_Port3);
  77. DDX_DateTimeCtrl(pDX, IDC_DATESTART, m_ctDateStart);
  78. DDX_DateTimeCtrl(pDX, IDC_DATESTOP, m_ctDateStop);
  79. DDX_DateTimeCtrl(pDX, IDC_TIMESTART, m_ctTimeStart);
  80. DDX_DateTimeCtrl(pDX, IDC_TIMESTOP, m_ctTimeStop);
  81. DDX_Text(pDX, IDC_EDITUSERNAME3, m_UserName2);
  82. DDX_Text(pDX, IDC_EDITUSERPSW3, m_Psw2);
  83. //}}AFX_DATA_MAP
  84. }
  85. BEGIN_MESSAGE_MAP(CDecCfg, CDialog)
  86. //{{AFX_MSG_MAP(CDecCfg)
  87. ON_CBN_SELCHANGE(IDC_COMBODECNO, OnSelchangeCombodecno)
  88. ON_CBN_SELCHANGE(IDC_COMBONO, OnSelchangeCombono)
  89. ON_BN_CLICKED(IDC_BUTOK, OnButok)
  90. ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
  91. ON_BN_CLICKED(IDC_BUTCHANOK, OnButchanok)
  92. ON_BN_CLICKED(IDC_BUTDECOK, OnButdecok)
  93. ON_BN_CLICKED(IDC_BUTSTARTDEC, OnButstartdec)
  94. ON_BN_CLICKED(IDC_BUTSTOPDEC, OnButstopdec)
  95. ON_BN_CLICKED(IDC_BUTSCREEN, OnButscreen)
  96. ON_BN_CLICKED(IDC_BUTTRANSOK, OnButtransok)
  97. ON_BN_CLICKED(IDC_BUTTRANSOK2, OnButtransok2)
  98. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  99. ON_BN_CLICKED(IDC_BUTCTRLDEC1, OnButctrldec1)
  100. ON_BN_CLICKED(IDC_BUTCTRLDEC2, OnButctrldec2)
  101. ON_BN_CLICKED(IDC_BUTCTRLDEC3, OnButctrldec3)
  102. ON_BN_CLICKED(IDC_BUTCTRLDEC4, OnButctrldec4)
  103. ON_BN_CLICKED(IDC_BUTCTRL, OnButctrl)
  104. ON_BN_CLICKED(IDC_BUTDEFAULT, OnButdefault)
  105. ON_BN_CLICKED(IDC_BUTSTATUS, OnButstatus)
  106. //}}AFX_MSG_MAP
  107. END_MESSAGE_MAP()
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CDecCfg message handlers
  110. BOOL CDecCfg::OnInitDialog()
  111. {
  112. CDialog::OnInitDialog();
  113. // TODO: Add extra initialization here
  114. CRect rc(0, 0, 0, 0);
  115. GetParent()->GetClientRect(&rc);
  116. ((CTabCtrl*)GetParent())->AdjustRect(FALSE, &rc);
  117. MoveWindow(&rc);
  118. m_NoCtrl.SetCurSel(0);
  119. m_NumCtrl.SetCurSel(0);
  120. m_ChanCtrl.SetCurSel(0);
  121. m_DecNoCtrl.SetCurSel(0);
  122. m_DecNumCtrl.SetCurSel(0);
  123. m_ProtCtrl.SetCurSel(0);
  124. m_TimeCtrl.SetCurSel(0);
  125. m_lSelWnd = 0;
  126. m_lSelDecNo = 0;
  127. m_lChannel = 0;
  128. if(NET_DVR_GetDecInfo(m_lServerID, 0, &Decoderinfo))
  129. {
  130. m_NumCtrl.SetCurSel(Decoderinfo.dwDecChanNum);
  131. m_NoCtrl.SetCurSel(m_lSelWnd);
  132. m_bChk = Decoderinfo.struDecInfo[m_lSelWnd].byEnablePoll;
  133. m_TimeCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].byPoolTime-1);
  134. m_DecNumCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].byPoolChans);
  135. m_DecNoCtrl.SetCurSel(m_lSelDecNo);
  136. m_ChanCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel-1);
  137. m_ProtCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode);
  138. m_ProTypeCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType);
  139. m_UserName.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName);
  140. m_Psw.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword);
  141. m_Ip.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP);
  142. m_Port = Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort;
  143. }
  144. m_lSelTrans = 0;
  145. m_transctrl.SetCurSel(m_lSelTrans);
  146. if (NET_DVR_GetDecTransPort(m_lServerID, &TransPort))
  147. {
  148. m_bChkTrans = TransPort.struTransPortInfo[m_lSelTrans].dwEnableTransPort;
  149. m_DVRTransCtrl.SetCurSel(TransPort.struTransPortInfo[m_lSelTrans].wDVRTransPort-1);
  150. m_Ip2.Format("%s", TransPort.struTransPortInfo[m_lSelTrans].sDecoderIP);
  151. m_Port2 = TransPort.struTransPortInfo[m_lSelTrans].wDecoderPort;
  152. }
  153. else
  154. {
  155. MessageBox("获取解码设备透明通道参数失败!", "温馨提示", MB_ICONINFORMATION);
  156. }
  157. m_lChannel = 0;
  158. m_specnoctrl.SetCurSel(m_lChannel);
  159. m_ChanCtrl1.SetCurSel(0);
  160. m_ProtCtrl1.SetCurSel(0);
  161. m_UserName1.Format("%s", "admin");
  162. m_Psw1.Format("%s", "12345");
  163. m_Ip1.Format("%s", "0.0.0.0");
  164. m_Port1 = 8000;
  165. m_Ip3.Format("%s", "0.0.0.0");
  166. m_Port3 = 8000;
  167. m_typeCtrl.SetCurSel(0);
  168. m_ctrl.SetCurSel(0);
  169. m_ChanCtrl2.SetCurSel(0);
  170. m_filename = "";
  171. UpdateData(FALSE);
  172. return TRUE; // return TRUE unless you set the focus to a control
  173. // EXCEPTION: OCX Property Pages should return FALSE
  174. }
  175. void CDecCfg::OnOK()
  176. {
  177. // TODO: Add extra validation here
  178. // CDialog::OnOK();
  179. }
  180. void CDecCfg::OnCancel()
  181. {
  182. // TODO: Add extra cleanup here
  183. // CDialog::OnCancel();
  184. }
  185. void CDecCfg::OnSelchangeCombodecno()
  186. {
  187. // TODO: Add your control notification handler code here
  188. UpdateData(TRUE);
  189. m_lSelDecNo = m_DecNoCtrl.GetCurSel();
  190. m_ChanCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel-1);
  191. m_ProtCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode);
  192. m_ProTypeCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType);
  193. m_UserName.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName);
  194. m_Psw.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword);
  195. m_Ip.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP);
  196. m_Port = Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort;
  197. UpdateData(FALSE);
  198. }
  199. void CDecCfg::OnSelchangeCombono()
  200. {
  201. // TODO: Add your control notification handler code here
  202. UpdateData(TRUE);
  203. m_lSelWnd = m_NoCtrl.GetCurSel();
  204. m_bChk = Decoderinfo.struDecInfo[m_lSelWnd].byEnablePoll;
  205. m_TimeCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].byPoolTime-1);
  206. m_DecNumCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].byPoolChans);
  207. m_DecNoCtrl.SetCurSel(m_lSelDecNo);
  208. m_ChanCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel-1);
  209. m_ProtCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode);
  210. m_ProTypeCtrl.SetCurSel(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType);
  211. m_UserName.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName);
  212. m_Psw.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword);
  213. m_Ip.Format("%s", Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP);
  214. m_Port = Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort;
  215. UpdateData(FALSE);
  216. }
  217. void CDecCfg::OnButok()
  218. {
  219. // TODO: Add your control notification handler code here
  220. UpdateData(TRUE);
  221. Decoderinfo.dwDecChanNum = m_NumCtrl.GetCurSel();
  222. m_lSelWnd = m_NoCtrl.GetCurSel();
  223. Decoderinfo.struDecInfo[m_lSelWnd].byEnablePoll = m_bChk;
  224. Decoderinfo.struDecInfo[m_lSelWnd].byPoolTime = m_TimeCtrl.GetCurSel()+1;
  225. Decoderinfo.struDecInfo[m_lSelWnd].byPoolChans = m_DecNumCtrl.GetCurSel();
  226. m_lSelDecNo = m_DecNoCtrl.GetCurSel();
  227. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel = m_ChanCtrl.GetCurSel()+1;
  228. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode = m_ProtCtrl.GetCurSel();
  229. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType = m_ProTypeCtrl.GetCurSel();
  230. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName, m_UserName, NAME_LEN);
  231. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword, m_Psw, PASSWD_LEN);
  232. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP, m_Ip, 16);
  233. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort = m_Port;
  234. if(NET_DVR_SetDecInfo(m_lServerID, 0, &Decoderinfo))
  235. {
  236. MessageBox("设置参数成功!", "温馨提示", MB_ICONINFORMATION);
  237. }
  238. else
  239. {
  240. MessageBox("设置参数失败!", "温馨提示", MB_ICONINFORMATION);
  241. }
  242. }
  243. void CDecCfg::OnButexit()
  244. {
  245. // TODO: Add your control notification handler code here
  246. // CDialog::OnOK();
  247. }
  248. void CDecCfg::OnButchanok()
  249. {
  250. // TODO: Add your control notification handler code here
  251. UpdateData(TRUE);
  252. m_lSelWnd = m_NoCtrl.GetCurSel();
  253. m_lSelDecNo = m_DecNoCtrl.GetCurSel();
  254. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel = m_ChanCtrl.GetCurSel()+1;
  255. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode = m_ProtCtrl.GetCurSel();
  256. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName, m_UserName, NAME_LEN);
  257. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword, m_Psw, PASSWD_LEN);
  258. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP, m_Ip, 16);
  259. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort = m_Port;
  260. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType = m_ProTypeCtrl.GetCurSel();
  261. }
  262. void CDecCfg::OnButdecok()
  263. {
  264. // TODO: Add your control notification handler code here
  265. UpdateData(TRUE);
  266. m_lSelWnd = m_NoCtrl.GetCurSel();
  267. Decoderinfo.struDecInfo[m_lSelWnd].byEnablePoll = m_bChk;
  268. Decoderinfo.struDecInfo[m_lSelWnd].byPoolTime = m_TimeCtrl.GetCurSel()+1;
  269. Decoderinfo.struDecInfo[m_lSelWnd].byPoolChans = m_DecNumCtrl.GetCurSel();
  270. m_lSelDecNo = m_DecNoCtrl.GetCurSel();
  271. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byChannel = m_ChanCtrl.GetCurSel()+1;
  272. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkMode = m_ProtCtrl.GetCurSel();
  273. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].byLinkType = m_ProTypeCtrl.GetCurSel();
  274. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sUserName, m_UserName, NAME_LEN);
  275. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sPassword, m_Psw, PASSWD_LEN);
  276. memcpy(Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].sDVRIP, m_Ip, 16);
  277. Decoderinfo.struDecInfo[m_lSelWnd].struchanConInfo[m_lSelDecNo].wDVRPort = m_Port;
  278. }
  279. void CDecCfg::OnButstartdec()
  280. {
  281. // TODO: Add your control notification handler code here
  282. UpdateData(TRUE);
  283. m_lChannel = m_specnoctrl.GetCurSel();
  284. NET_DVR_DECCHANINFO DecChanInfo;
  285. DecChanInfo.byChannel = m_ChanCtrl1.GetCurSel()+1;
  286. DecChanInfo.byLinkMode = m_ProtCtrl1.GetCurSel();
  287. DecChanInfo.byLinkType = m_ProTypeCtrl1.GetCurSel();
  288. memcpy(DecChanInfo.sUserName, m_UserName1, NAME_LEN);
  289. memcpy(DecChanInfo.sPassword, m_Psw1, PASSWD_LEN);
  290. memcpy(DecChanInfo.sDVRIP, m_Ip1, 16);
  291. DecChanInfo.wDVRPort = m_Port1;
  292. if (!NET_DVR_StartDecSpecialCon(m_lServerID, m_lChannel+m_lStartChan, &DecChanInfo))
  293. {
  294. MessageBox("启动动态连接失败!", "温馨提示", MB_ICONINFORMATION);
  295. }
  296. }
  297. void CDecCfg::OnButstopdec()
  298. {
  299. // TODO: Add your control notification handler code here
  300. UpdateData(TRUE);
  301. m_lChannel = m_specnoctrl.GetCurSel();
  302. NET_DVR_DECCHANINFO DecChanInfo;
  303. DecChanInfo.byChannel = m_ChanCtrl1.GetCurSel()+1;
  304. DecChanInfo.byLinkMode = m_ProtCtrl1.GetCurSel();
  305. DecChanInfo.byLinkType = m_ProTypeCtrl1.GetCurSel();
  306. memcpy(DecChanInfo.sUserName, m_UserName1, NAME_LEN);
  307. memcpy(DecChanInfo.sPassword, m_Psw1, PASSWD_LEN);
  308. memcpy(DecChanInfo.sDVRIP, m_Ip1, 16);
  309. DecChanInfo.wDVRPort = m_Port1;
  310. if(!NET_DVR_StopDecSpecialCon(m_lServerID, m_lChannel+m_lStartChan, &DecChanInfo))
  311. {
  312. MessageBox("停止动态连接失败!", "温馨提示", MB_ICONINFORMATION);
  313. }
  314. }
  315. void CDecCfg::OnButscreen()
  316. {
  317. // TODO: Add your control notification handler code here
  318. UpdateData(TRUE);
  319. m_lChannel = m_specnoctrl.GetCurSel();
  320. if (!NET_DVR_DecCtrlScreen(m_lServerID, m_lChannel+m_lStartChan, 1))
  321. {
  322. MessageBox("全屏操作失败!", "温馨提示", MB_ICONINFORMATION);
  323. }
  324. }
  325. void CDecCfg::OnButtransok()
  326. {
  327. // TODO: Add your control notification handler code here
  328. UpdateData(TRUE);
  329. m_lSelTrans = m_transctrl.GetCurSel();
  330. TransPort.struTransPortInfo[m_lSelTrans].dwEnableTransPort = m_bChkTrans;
  331. memcpy(TransPort.struTransPortInfo[m_lSelTrans].sDecoderIP, m_Ip2, 16);
  332. TransPort.struTransPortInfo[m_lSelTrans].wDecoderPort = m_Port2;
  333. TransPort.struTransPortInfo[m_lSelTrans].wDVRTransPort = m_DVRTransCtrl.GetCurSel()+1;
  334. if (NET_DVR_SetDecTransPort(m_lServerID, &TransPort))
  335. {
  336. MessageBox("设置解码设备透明通道参数成功!", "温馨提示", MB_ICONINFORMATION);
  337. }
  338. else
  339. {
  340. MessageBox("设置解码设备透明通道参数失败!", "温馨提示", MB_ICONINFORMATION);
  341. }
  342. }
  343. void CDecCfg::OnButtransok2()
  344. {
  345. // TODO: Add your control notification handler code here
  346. UpdateData(TRUE);
  347. m_lSelTrans = m_transctrl.GetCurSel();
  348. TransPort.struTransPortInfo[m_lSelTrans].dwEnableTransPort = m_bChkTrans;
  349. memcpy(TransPort.struTransPortInfo[m_lSelTrans].sDecoderIP, m_Ip2, 16);
  350. TransPort.struTransPortInfo[m_lSelTrans].wDecoderPort = m_Port2;
  351. TransPort.struTransPortInfo[m_lSelTrans].wDVRTransPort = m_DVRTransCtrl.GetCurSel()+1;
  352. }
  353. void CDecCfg::OnSelchangeCombo1()
  354. {
  355. // TODO: Add your control notification handler code here
  356. UpdateData(TRUE);
  357. m_lSelTrans = m_transctrl.GetCurSel();
  358. m_bChkTrans = TransPort.struTransPortInfo[m_lSelTrans].dwEnableTransPort;
  359. m_DVRTransCtrl.SetCurSel(TransPort.struTransPortInfo[m_lSelTrans].wDVRTransPort-1);
  360. m_Ip2.Format("%s", TransPort.struTransPortInfo[m_lSelTrans].sDecoderIP);
  361. m_Port2 = TransPort.struTransPortInfo[m_lSelTrans].wDecoderPort;
  362. UpdateData(FALSE);
  363. }
  364. void CDecCfg::OnButctrldec1()
  365. {
  366. // TODO: Add your control notification handler code here
  367. UpdateData(TRUE);
  368. m_lChannel = m_specnoctrl.GetCurSel();
  369. if (!NET_DVR_DecCtrlDec(m_lServerID, m_lChannel+m_lStartChan, NET_DEC_STARTDEC))
  370. {
  371. MessageBox("启动解码失败!", "温馨提示", MB_ICONINFORMATION);
  372. }
  373. }
  374. void CDecCfg::OnButctrldec2()
  375. {
  376. // TODO: Add your control notification handler code here
  377. UpdateData(TRUE);
  378. m_lChannel = m_specnoctrl.GetCurSel();
  379. if (!NET_DVR_DecCtrlDec(m_lServerID, m_lChannel+m_lStartChan, NET_DEC_STOPDEC))
  380. {
  381. MessageBox("停止解码失败!", "温馨提示", MB_ICONINFORMATION);
  382. }
  383. }
  384. void CDecCfg::OnButctrldec3()
  385. {
  386. // TODO: Add your control notification handler code here
  387. UpdateData(TRUE);
  388. m_lChannel = m_specnoctrl.GetCurSel();
  389. if (!NET_DVR_DecCtrlDec(m_lServerID, m_lChannel+m_lStartChan, NET_DEC_STOPCYCLE))
  390. {
  391. MessageBox("停止轮巡失败!", "温馨提示", MB_ICONINFORMATION);
  392. }
  393. }
  394. void CDecCfg::OnButctrldec4()
  395. {
  396. // TODO: Add your control notification handler code here
  397. UpdateData(TRUE);
  398. m_lChannel = m_specnoctrl.GetCurSel();
  399. if (!NET_DVR_DecCtrlDec(m_lServerID, m_lChannel+m_lStartChan, NET_DEC_CONTINUECYCLE))
  400. {
  401. MessageBox("恢复轮巡失败!", "温馨提示", MB_ICONINFORMATION);
  402. }
  403. }
  404. void CDecCfg::OnButctrl()
  405. {
  406. // TODO: Add your control notification handler code here
  407. UpdateData(TRUE);
  408. m_lChannel = m_specnoctrl.GetCurSel();
  409. NET_DVR_PLAYREMOTEFILE RemoteFileInfo;
  410. RemoteFileInfo.dwSize = sizeof(NET_DVR_PLAYREMOTEFILE);
  411. memcpy(RemoteFileInfo.sDecoderIP, m_Ip3, 16);
  412. RemoteFileInfo.wDecoderPort = m_Port3;
  413. RemoteFileInfo.wLoadMode = m_typeCtrl.GetCurSel()+1;
  414. if (m_typeCtrl.GetCurSel() == 0)
  415. {
  416. memcpy(RemoteFileInfo.mode_size.byFile, m_filename, 100);
  417. }
  418. else
  419. {
  420. RemoteFileInfo.mode_size.bytime.dwChannel = m_ChanCtrl2.GetCurSel()+1;
  421. memcpy(RemoteFileInfo.mode_size.bytime.sUserName, m_UserName2, NAME_LEN);
  422. memcpy(RemoteFileInfo.mode_size.bytime.sPassword, m_Psw2, PASSWD_LEN);
  423. RemoteFileInfo.mode_size.bytime.struStartTime.dwYear = (WORD)m_ctDateStart.GetYear();
  424. RemoteFileInfo.mode_size.bytime.struStartTime.dwMonth = (WORD)m_ctDateStart.GetMonth();
  425. RemoteFileInfo.mode_size.bytime.struStartTime.dwDay = (WORD)m_ctDateStart.GetDay();
  426. RemoteFileInfo.mode_size.bytime.struStartTime.dwHour = (char)m_ctTimeStart.GetHour();
  427. RemoteFileInfo.mode_size.bytime.struStartTime.dwMinute = (char)m_ctTimeStart.GetMinute();
  428. RemoteFileInfo.mode_size.bytime.struStartTime.dwSecond = (char)m_ctTimeStart.GetSecond();
  429. RemoteFileInfo.mode_size.bytime.struStopTime.dwYear = (WORD)m_ctDateStop.GetYear();
  430. RemoteFileInfo.mode_size.bytime.struStopTime.dwMonth = (WORD)m_ctDateStop.GetMonth();
  431. RemoteFileInfo.mode_size.bytime.struStopTime.dwDay = (WORD)m_ctDateStop.GetDay();
  432. RemoteFileInfo.mode_size.bytime.struStopTime.dwHour = (char)m_ctTimeStop.GetHour();
  433. RemoteFileInfo.mode_size.bytime.struStopTime.dwMinute = (char)m_ctTimeStop.GetMinute();
  434. RemoteFileInfo.mode_size.bytime.struStopTime.dwSecond = (char)m_ctTimeStop.GetSecond();
  435. }
  436. if (!NET_DVR_DecPlayBackCtrl(m_lServerID, m_lChannel+m_lStartChan, m_ctrl.GetCurSel()+1, 0, NULL, &RemoteFileInfo))
  437. {
  438. MessageBox("控制回放文件失败!", "温馨提示", MB_ICONINFORMATION);
  439. }
  440. }
  441. /*
  442. void CDecCfg::OnButstatus()
  443. {
  444. // TODO: Add your control notification handler code here
  445. TRACE("hello");
  446. CDecStatus Dlg;
  447. UpdateData(TRUE);
  448. m_lChannel = m_specnoctrl.GetCurSel();
  449. Dlg.m_lServerID = m_lServerID;
  450. Dlg.m_lChannel = m_lChannel;
  451. Dlg.m_lStartChan = m_lStartChan;
  452. Dlg.DoModal();
  453. }
  454. */
  455. void CDecCfg::OnButdefault()
  456. {
  457. // TODO: Add your control notification handler code here
  458. UpdateData(TRUE);
  459. m_lChannel = m_specnoctrl.GetCurSel();
  460. if (!NET_DVR_DecCtrlScreen(m_lServerID, m_lChannel+m_lStartChan, 2))
  461. {
  462. MessageBox("还原操作失败!", "温馨提示", MB_ICONINFORMATION);
  463. }
  464. }
  465. void CDecCfg::OnButstatus()
  466. {
  467. // TODO: Add your control notification handler code here
  468. CDecStatus Dlg;
  469. UpdateData(TRUE);
  470. m_lChannel = m_specnoctrl.GetCurSel();
  471. Dlg.m_lServerID = m_lServerID;
  472. Dlg.m_lChannel = m_lChannel;
  473. Dlg.m_lStartChan = m_lStartChan;
  474. Dlg.DoModal();
  475. }