⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 property.cpp

📁 这是一个手机校准程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
// property.cpp
// calibration properties
// 7/29/00
// n steffen
//

#include "stdafx.h"
#include "resource.h"
#include "property.h"
#include "caltypes.h"
#ifndef USER_PARAMS
#include "user_params.h"
#endif

extern UserDefParm_t CurParm;

void save_tester_type_in_registry(TesterType_t tester_type)
  {
	CWinApp* pApp;
  
  pApp=AfxGetApp();
  
  pApp->WriteProfileInt(PLIST_REGISTRYKEY,PLIST_TESTERTYPEKEY,tester_type);
  }

TesterType_t get_tester_type()
  {
	CWinApp* pApp;
  TesterType_t tester_type;    

  pApp=AfxGetApp();
  
  tester_type=(TesterType_t)pApp->GetProfileInt(PLIST_REGISTRYKEY,PLIST_TESTERTYPEKEY,HP8922);
  return tester_type;
  }

void save_pac_type_in_registry(PACCalType_t pac_type)
  {
	CWinApp* pApp;
  
  pApp=AfxGetApp();
  
  pApp->WriteProfileInt(PLIST_REGISTRYKEY,PLIST_PACTYPEKEY,pac_type);
  }

PACCalType_t get_pac_type()
  {
	CWinApp* pApp;
  PACCalType_t pac_type;    

  pApp=AfxGetApp();
  
  pac_type=(PACCalType_t)pApp->GetProfileInt(PLIST_REGISTRYKEY,PLIST_PACTYPEKEY,INFINEON);
  return pac_type;
  }

void save_parameter_template_in_registry(CString filename)
  {
	CWinApp* pApp;
  
  pApp=AfxGetApp();
  
  pApp->WriteProfileString(PLIST_REGISTRYKEY,PLIST_PARMTEMPLATEKEY,filename);
  }

CString get_parameter_template_filename()
  {
	CWinApp* pApp;
	CString string;
  
  pApp=AfxGetApp();
  
  string=pApp->GetProfileString(PLIST_REGISTRYKEY,PLIST_PARMTEMPLATEKEY);
  return string;
  }

void save_output_filename_in_registry(CString filename)
  {
	CWinApp* pApp;
  
  pApp=AfxGetApp();
  
  pApp->WriteProfileString(PLIST_REGISTRYKEY,PLIST_OUTPUTFILEKEY,filename);
  }

CString get_output_filename()
  {
	CWinApp* pApp;
	CString string;
  
  pApp=AfxGetApp();
  
  string=pApp->GetProfileString(PLIST_REGISTRYKEY,PLIST_OUTPUTFILEKEY);
  return string;
  }


//----------- GSM properties
CGSMParameters::OnInitDialog()
  {
  CString string;

  string.Format("%d",CurParm.gsm_test_channel);
  ((CEdit *)(GetDlgItem(IDC_GSM_TEST_CHANNEL)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm_highest_power);
  ((CEdit *)(GetDlgItem(IDC_GSM_HIGHEST_POWER)))->SetWindowText(string);
  string.Format("%d",CurParm.gsm_ramp_start);
  ((CEdit *)(GetDlgItem(IDC_GSM_RAMP_START)))->SetWindowText(string);
  string.Format("%d",CurParm.gsm_ramp_end);
  ((CEdit *)(GetDlgItem(IDC_GSM_RAMP_END)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm_tx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_GSM_TX_CABLE_LOSS)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm_rx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_GSM_RX_CABLE_LOSS)))->SetWindowText(string);

  return TRUE;
  };

CGSMParameters::OnApply()
  {
  CString string;

  ((CEdit *)(GetDlgItem(IDC_GSM_TEST_CHANNEL)))->GetWindowText(string);
  CurParm.gsm_test_channel=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM_HIGHEST_POWER)))->GetWindowText(string);
  CurParm.gsm_highest_power=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM_RAMP_START)))->GetWindowText(string);
  CurParm.gsm_ramp_start=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM_RAMP_END)))->GetWindowText(string);
  CurParm.gsm_ramp_end=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM_TX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.gsm_tx_cable_loss=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM_RX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.gsm_rx_cable_loss=(float)atof((LPCTSTR)string);

  set_parameters_in_registry(&CurParm);
  return TRUE;
  };

void CGSMParameters::OnOK()
  {
  OnApply();
  }

BEGIN_MESSAGE_MAP(CGSMParameters,CPropertyPage)
END_MESSAGE_MAP()

//----------- DCS properties
CDCSParameters::OnInitDialog()
  {
  CString string;
  
  string.Format("%d",CurParm.dcs_test_channel);
  ((CEdit *)(GetDlgItem(IDC_DCS_TEST_CHANNEL)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.dcs_highest_power);
  ((CEdit *)(GetDlgItem(IDC_DCS_HIGHEST_POWER)))->SetWindowText(string);
  string.Format("%d",CurParm.dcs_ramp_start);
  ((CEdit *)(GetDlgItem(IDC_DCS_RAMP_START)))->SetWindowText(string);
  string.Format("%d",CurParm.dcs_ramp_end);
  ((CEdit *)(GetDlgItem(IDC_DCS_RAMP_END)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.dcs_tx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_DCS_TX_CABLE_LOSS)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.dcs_rx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_DCS_RX_CABLE_LOSS)))->SetWindowText(string);

  return TRUE;
  };

CDCSParameters::OnApply()
  {
  CString string;

  ((CEdit *)(GetDlgItem(IDC_DCS_TEST_CHANNEL)))->GetWindowText(string);
  CurParm.dcs_test_channel=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_DCS_HIGHEST_POWER)))->GetWindowText(string);
  CurParm.dcs_highest_power=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_DCS_RAMP_START)))->GetWindowText(string);
  CurParm.dcs_ramp_start=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_DCS_RAMP_END)))->GetWindowText(string);
  CurParm.dcs_ramp_end=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_DCS_TX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.dcs_tx_cable_loss=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_DCS_RX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.dcs_rx_cable_loss=(float)atof((LPCTSTR)string);

  set_parameters_in_registry(&CurParm);
  return TRUE;
  };

void CDCSParameters::OnOK()
  {
  OnApply();
  }

BEGIN_MESSAGE_MAP(CDCSParameters,CPropertyPage)
END_MESSAGE_MAP()

//----------- PCS properties
CPCSParameters::OnInitDialog()
  {
  CString string;
  
  string.Format("%d",CurParm.pcs_test_channel);
  ((CEdit *)(GetDlgItem(IDC_PCS_TEST_CHANNEL)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.pcs_highest_power);
  ((CEdit *)(GetDlgItem(IDC_PCS_HIGHEST_POWER)))->SetWindowText(string);
  string.Format("%d",CurParm.pcs_ramp_start);
  ((CEdit *)(GetDlgItem(IDC_PCS_RAMP_START)))->SetWindowText(string);
  string.Format("%d",CurParm.pcs_ramp_end);
  ((CEdit *)(GetDlgItem(IDC_PCS_RAMP_END)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.pcs_tx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_PCS_TX_CABLE_LOSS)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.pcs_rx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_PCS_RX_CABLE_LOSS)))->SetWindowText(string);

  return TRUE;
  };

CPCSParameters::OnApply()
  {
  CString string;

  ((CEdit *)(GetDlgItem(IDC_PCS_TEST_CHANNEL)))->GetWindowText(string);
  CurParm.pcs_test_channel=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_PCS_HIGHEST_POWER)))->GetWindowText(string);
  CurParm.pcs_highest_power=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_PCS_RAMP_START)))->GetWindowText(string);
  CurParm.pcs_ramp_start=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_PCS_RAMP_END)))->GetWindowText(string);
  CurParm.pcs_ramp_end=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_PCS_TX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.pcs_tx_cable_loss=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_PCS_RX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.pcs_rx_cable_loss=(float)atof((LPCTSTR)string);

  set_parameters_in_registry(&CurParm);
  return TRUE;
  };

void CPCSParameters::OnOK()
  {
  OnApply();
  }

BEGIN_MESSAGE_MAP(CPCSParameters,CPropertyPage)
END_MESSAGE_MAP()

//----------- GSM850 properties
CGSM850Parameters::OnInitDialog()
  {
  CString string;

  string.Format("%d",CurParm.gsm850_test_channel);
  ((CEdit *)(GetDlgItem(IDC_GSM850_TEST_CHANNEL)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm850_highest_power);
  ((CEdit *)(GetDlgItem(IDC_GSM850_HIGHEST_POWER)))->SetWindowText(string);
  string.Format("%d",CurParm.gsm850_ramp_start);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RAMP_START)))->SetWindowText(string);
  string.Format("%d",CurParm.gsm850_ramp_end);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RAMP_END)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm850_tx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_GSM850_TX_CABLE_LOSS)))->SetWindowText(string);
  string.Format("%4.1f",CurParm.gsm850_rx_cable_loss);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RX_CABLE_LOSS)))->SetWindowText(string);

  return TRUE;
  };

CGSM850Parameters::OnApply()
  {
  CString string;

  ((CEdit *)(GetDlgItem(IDC_GSM850_TEST_CHANNEL)))->GetWindowText(string);
  CurParm.gsm850_test_channel=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM850_HIGHEST_POWER)))->GetWindowText(string);
  CurParm.gsm850_highest_power=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RAMP_START)))->GetWindowText(string);
  CurParm.gsm850_ramp_start=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RAMP_END)))->GetWindowText(string);
  CurParm.gsm850_ramp_end=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM850_TX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.gsm850_tx_cable_loss=(float)atof((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_GSM850_RX_CABLE_LOSS)))->GetWindowText(string);
  CurParm.gsm850_rx_cable_loss=(float)atof((LPCTSTR)string);

  set_parameters_in_registry(&CurParm);
  return TRUE;
  };

void CGSM850Parameters::OnOK()
  {
  OnApply();
  }

BEGIN_MESSAGE_MAP(CGSM850Parameters,CPropertyPage)
END_MESSAGE_MAP()

//----------- General properties
CGeneralParameters::OnInitDialog()
  {
  CString string;

  string.Format("%d",CurParm.gpib_address);
  ((CEdit *)(GetDlgItem(IDC_GPIB_ADDRESS)))->SetWindowText(string);
  string.Format("%d",CurParm.com_port);
  ((CEdit *)(GetDlgItem(IDC_COM_PORT)))->SetWindowText(string);
  if(CurParm.cal_gsm)
    {
    ((CButton *)(GetDlgItem(IDC_CAL_GSM)))->SetCheck(TRUE);
    }
  if(CurParm.cal_dcs)
    {
    ((CButton *)(GetDlgItem(IDC_CAL_DCS)))->SetCheck(TRUE);
    }
  if(CurParm.cal_pcs)
    {
    ((CButton *)(GetDlgItem(IDC_CAL_PCS)))->SetCheck(TRUE);
    }
  if(CurParm.cal_gsm850)
	{
	((CButton *)(GetDlgItem(IDC_CAL_GSM850)))->SetCheck(TRUE);
	 }
  if(CurParm.cal_rx)
    {
    ((CButton *)(GetDlgItem(IDC_CAL_RX)))->SetCheck(TRUE);
    }


  return TRUE;
  };

CGeneralParameters::OnApply()
  {
  CString string;

  ((CEdit *)(GetDlgItem(IDC_GPIB_ADDRESS)))->GetWindowText(string);
  CurParm.gpib_address=atoi((LPCTSTR)string);
  ((CEdit *)(GetDlgItem(IDC_COM_PORT)))->GetWindowText(string);
  CurParm.com_port=atoi((LPCTSTR)string);
  if(((CButton *)(GetDlgItem(IDC_CAL_GSM)))->GetCheck())
    {
    CurParm.cal_gsm=TRUE;
    }
  else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -