SysSetting.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // SysSetting.cpp : 实现文件
  2. //
  3. #include "stdafx.h"
  4. #include "YAServer.h"
  5. #include "SysSetting.h"
  6. #include "afxdialogex.h"
  7. #include "Functions/Functions.h"
  8. // CSysSetting 对话框
  9. IMPLEMENT_DYNAMIC(CSysSetting, CDialogEx)
  10. CSysSetting::CSysSetting(CWnd* pParent /*=NULL*/)
  11. : CDialogEx(CSysSetting::IDD, pParent)
  12. , m_host_master(_T(""))
  13. , m_recon_server(0)
  14. , m_host_slave(_T(""))
  15. , m_recon_db(0)
  16. , m_reader_lost(0)
  17. , m_card_lost(0)
  18. , m_timing_interval(0)
  19. , m_coor_error(0)
  20. , m_ranging_error(0)
  21. , m_move_error(0)
  22. , m_sampling_interval(0)
  23. , m_use_filter(FALSE)
  24. , m_db_z_offset(0)
  25. , m_port(9700)
  26. {
  27. m_host_master = CFunctions::c2wc(theApp.ws_url.c_str());
  28. m_host_slave = CFunctions::c2wc(theApp.ws_url_bk.c_str());
  29. m_recon_db = theApp.recon_db;
  30. m_recon_server = theApp.recon_server;
  31. m_reader_lost = theApp.reader_lost;
  32. m_card_lost = theApp.card_lost;
  33. m_timing_interval = theApp.timing_interval;
  34. m_sampling_interval = theApp.sampling_interval;
  35. m_coor_error = theApp.coor_error;
  36. m_ranging_error = theApp.ranging_error;
  37. m_move_error = theApp.move_error;
  38. m_use_filter = theApp.use_filter;
  39. m_db_z_offset = theApp.z_offset;
  40. m_port = theApp.tcp_port;
  41. }
  42. CSysSetting::~CSysSetting()
  43. {
  44. }
  45. void CSysSetting::DoDataExchange(CDataExchange* pDX)
  46. {
  47. CDialogEx::DoDataExchange(pDX);
  48. DDX_Text(pDX, IDC_EDIT1, m_host_master);
  49. DDV_MaxChars(pDX, m_host_master, 255);
  50. DDX_Text(pDX, IDC_EDIT15, m_recon_server);
  51. DDX_Text(pDX, IDC_EDIT5, m_host_slave);
  52. DDX_Text(pDX, IDC_EDIT13, m_recon_db);
  53. DDX_Text(pDX, IDC_EDIT8, m_reader_lost);
  54. //DDV_MinMaxInt(pDX, m_reader_lost, 15, 7200);
  55. DDX_Text(pDX, IDC_EDIT10, m_card_lost);
  56. DDX_Text(pDX, IDC_EDIT11, m_timing_interval);
  57. DDX_Text(pDX, IDC_EDIT9, m_coor_error);
  58. DDX_Text(pDX, IDC_EDIT14, m_ranging_error);
  59. DDX_Text(pDX, IDC_EDIT7, m_move_error);
  60. DDX_Text(pDX, IDC_EDIT12, m_sampling_interval);
  61. DDX_Check(pDX, IDC_ENABLE_FILTER, m_use_filter);
  62. DDX_Text(pDX, IDC_EDIT16, m_db_z_offset);
  63. }
  64. BEGIN_MESSAGE_MAP(CSysSetting, CDialogEx)
  65. ON_BN_CLICKED(IDOK, &CSysSetting::OnBnClickedOk)
  66. END_MESSAGE_MAP()
  67. BOOL CSysSetting::OnInitDialog()
  68. {
  69. CDialog::OnInitDialog();
  70. m_use_filter = theApp.use_filter;
  71. ((CButton*)GetDlgItem(IDC_ENABLE_FILTER))->SetCheck(m_use_filter);
  72. return TRUE;
  73. }
  74. // CSysSetting 消息处理程序
  75. /*
  76. * 保存系统参数设置
  77. *
  78. * param
  79. * 无
  80. *
  81. * return
  82. * 无
  83. */
  84. void CSysSetting::OnBnClickedOk()
  85. {
  86. UpdateData();
  87. //滤波器是否开启
  88. m_use_filter = ((CButton*)GetDlgItem(IDC_ENABLE_FILTER))->GetCheck();
  89. theApp.ws_url = CFunctions::wc2c(m_host_master);
  90. theApp.ws_url_bk = CFunctions::wc2c(m_host_slave);
  91. theApp.recon_db = m_recon_db;
  92. theApp.recon_server = m_recon_server;
  93. theApp.reader_lost = m_reader_lost;
  94. theApp.card_lost = m_card_lost;
  95. theApp.timing_interval = m_timing_interval;
  96. theApp.sampling_interval = m_sampling_interval;
  97. theApp.coor_error = m_coor_error;
  98. theApp.ranging_error = m_ranging_error;
  99. theApp.move_error = m_move_error;
  100. theApp.use_filter = m_use_filter;
  101. theApp.z_offset = m_db_z_offset;
  102. theApp.tcp_port = m_port;
  103. //将参数写入到配置文件中
  104. theApp.save_sys_conf();
  105. CDialogEx::OnOK();
  106. }