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

📄 syspara.cpp

📁 cdma无线通信转发程序 用于电力调度数据的转发
💻 CPP
字号:
// SysPara.cpp : implementation file
//

#include "stdafx.h"
#include "3104C.h"
#include "SysPara.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSysPara dialog


CSysPara::CSysPara(CWnd* pParent /*=NULL*/)
	: CDialog(CSysPara::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSysPara)
	m_chanNum = 0;
	m_dataNum = 0;
	m_timeNum = 0;
	m_rchanPara = _T("");
	m_rchanType = _T("");
	m_tchanPara = _T("");
	m_tchanType = _T("");
	m_termType = _T("");
	//}}AFX_DATA_INIT
	m_no =0;
}


void CSysPara::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSysPara)
	DDX_Control(pDX, IDC_CHAN_NO, m_chan_no);
	DDX_Text(pDX, IDC_CHAN_NUM, m_chanNum);
	DDX_Text(pDX, IDC_DATA_NUM, m_dataNum);
	DDX_Text(pDX, IDC_TIME_NUM, m_timeNum);
	DDX_Text(pDX, IDC_RCHAN_PARA, m_rchanPara);
	DDX_Text(pDX, IDC_RCHAN_TYPE, m_rchanType);
	DDX_Text(pDX, IDC_TCHAN_PARA, m_tchanPara);
	DDX_Text(pDX, IDC_TCHAN_TYPE, m_tchanType);
	DDX_Text(pDX, IDC_TERM_TYPE, m_termType);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSysPara, CDialog)
	//{{AFX_MSG_MAP(CSysPara)
	ON_CBN_SELCHANGE(IDC_CHAN_NO, OnSelchangeChanNo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSysPara message handlers

BOOL CSysPara::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CString str;
    for(int i=0; i<G_Channel.chan_num ; i++)
	{
		if(strcmp(G_Channel.chan_data [i].chanName,"")==0)
			str.Format("第%02d号通道",i);
		else
			str.Format("%s (通道%d)",G_Channel.chan_data[i].chanName,i);
		m_chan_no.AddString(str);
	}
    m_chan_no.SetCurSel(m_no);
	ShowSysPara(m_no);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

CString CSysPara::GetChanType(uchar type)
{
    CString str;
	if(type == COM)
		str = "RS232";
	else if(type == TCPRTU)
		str = "TCP";
	else if(type == UDPRTU)
		str = "UDP";
	else
		str = "未知";
	return str;
}

CString CSysPara::GetChanPara(DEVPARA *dev)
{
   if(dev == NULL) return "";
  
   CString str,str1;
   if(dev->Type == COM)
	{
		str.Format("%s,%d,",dev->devName,dev->Baud);
		if(dev->CheckBit == 0) str1 = "无";
		else if(dev->CheckBit == 1) str1 = "奇";
		else if(dev->CheckBit ==2)  str1 = "偶";
		str += str1;
		str1.Format(",%d,%d",dev->DataBit ,dev->StopBit);
		str+=str1;
	}
	else if(dev->Type == TCPRTU || dev->Type == UDPRTU)
	  str .Format("%s",dev->devName);
	else
		str = "错误";
	return str;
}

void CSysPara::ShowSysPara(int no)
{
    m_chanNum = G_Channel.chan_num;
	if(G_Channel.DynamicIpFlag > 0)
		m_termType = "动态IP地址";
	else
		m_termType = "静态IP地址";
	m_dataNum = G_Channel.recTrig ;
	m_timeNum = G_Channel.timeTrig;
	m_rchanPara = GetChanPara(&G_Channel.chan_data[no].rchanpara);
	m_rchanType = GetChanType(G_Channel.chan_data[no].rchanpara.Type);
	m_tchanPara = GetChanPara(&G_Channel.chan_data[no].tchanpara);
	m_tchanType = GetChanType(G_Channel.chan_data[no].tchanpara.Type);

	UpdateData(FALSE);
}

void CSysPara::OnSelchangeChanNo() 
{
    m_no = m_chan_no.GetCurSel();
	ShowSysPara(m_no);
}

⌨️ 快捷键说明

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