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

📄 dlgentparc.cpp

📁 对日本KSG震动探测仪器编写的伴侣服务代码
💻 CPP
字号:
// DlgEntParC.cpp : 僀儞僾儕儊儞僥乕僔儑儞 僼傽僀儖
//

#include "stdafx.h"
#include "KSG.h"
#include "DlgEntParC.h"
#include "C_Work.h"
#include "C_File.h"
#include "C_Proc.h"
#include "KSG_Main.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgEntParC 僟僀傾儘僌
struct	S_SND_PRM SetParCpy;		// 僐僺乕梡

// 憲怣僨乕僞
S_PARA_TABLE mTbl_P_Snd[] = {
	// 拞崙岦偗
	#if ATSUGI
		{ -1}
	#else
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].NowH_ID[0],IDC_EDT_I_01, 0,0,0,0 },	// 01:HOST ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].NowT_ID[0],IDC_EDT_I_02, 0,0,0,0 },	// 02:抂枛 ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].NewHId[0], IDC_EDT_I_03, 0,0,0,0 },	// 03:怴HOST ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].NewTId[0], IDC_EDT_I_04, 0,0,0,0 },	// 04:怴抂枛 ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].TrgAcc[0], IDC_EDT_I_05, 0,0,0,0 },	// 05:僩儕僈壛懍搙
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].TrgSin[0], IDC_EDT_I_06, 0,0,0,0 },	// 06:僩儕僈恔搙
		{ TYP_STR2,12,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].Ip_Adr[0], IDC_EDT_I_07, 0,0,0,0 },	// 07:怴帺嬊俬俹
		{ TYP_STR2,12,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].New_Ip[0], IDC_EDT_I_08, 0,0,0,0 },	// 08:怴儂僗僩俬俹
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].SensCt[0], IDC_EDT_I_09, 0,0,0,0 },	// 09:愙懕姶恔婍悢
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].StaAxs[0], IDC_EDT_I_10, 0,0,0,0 },	// 10:婲摦幉巜掕
		{ TYP_STR2, 3,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].GpsEnb[0], IDC_EDT_I_11, 0,0,0,0 },	// 11:俧俹俽應抧宯
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatCg1[0], IDC_EDT_I_12, 0,0,0,0 },	// 12:僶僢僥儕乕廩1
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatCg2[0], IDC_EDT_I_13, 0,0,0,0 },	// 13:僶僢僥儕乕廩2
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatCg3[0], IDC_EDT_I_14, 0,0,0,0 },	// 14:僶僢僥儕乕廩3
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatCg4[0], IDC_EDT_I_15, 0,0,0,0 },	// 15:僶僢僥儕乕廩4
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatUc1[0], IDC_EDT_I_16, 0,0,0,0 },	// 16:僶僢僥儕乕曻1
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatUc2[0], IDC_EDT_I_17, 0,0,0,0 },	// 17:僶僢僥儕乕曻2
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatUc3[0], IDC_EDT_I_18, 0,0,0,0 },	// 18:僶僢僥儕乕曻3
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].BatUc4[0], IDC_EDT_I_19, 0,0,0,0 },	// 19:僶僢僥儕乕曻4
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].ReTryC[0], IDC_EDT_I_20, 0,0,0,0 },	// 20:儕僩儔僀夞悢
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].ReTryT[0], IDC_EDT_I_21, 0,0,0,0 },	// 21:儕僩儔僀娫妘
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&SetPara[0].ComTye[0], IDC_EDT_I_22, 0,0,0,0 },	// 22:敪怣曽幃
		{ -1}
	#endif
};

// 庴怣僨乕僞
S_PARA_TABLE mTbl_P_Rcv[] = {
	#if ATSUGI
		{ -1}
	#else
		// 拞崙岦偗
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].Host_ID[0],IDC_EDT_O_01, 0,0,0,0 },	// 01:HOST ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].Term_ID[0],IDC_EDT_O_02, 0,0,0,0 },	// 02:抂枛 ID
		{ TYP_STR2, 8,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].TrgAcc[0], IDC_EDT_O_05, 0,0,0,0 },	// 05:僩儕僈壛懍搙
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].TrgSin[0], IDC_EDT_O_06, 0,0,0,0 },	// 06:僩儕僈恔搙
		{ TYP_STR2,12,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].Ip_Adr[0], IDC_EDT_O_07, 0,0,0,0 },	// 07:怴帺嬊俬俹
		{ TYP_STR2,12,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].New_Ip[0], IDC_EDT_O_08, 0,0,0,0 },	// 08:怴儂僗僩俬俹
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].SensCt[0], IDC_EDT_O_09, 0,0,0,0 },	// 09:愙懕姶恔婍悢
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].StaAxs[0], IDC_EDT_O_10, 0,0,0,0 },	// 10:婲摦幉巜掕
		{ TYP_STR2, 3,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].GpsEnb[0], IDC_EDT_O_11, 0,0,0,0 },	// 11:俧俹俽應抧宯
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatCg1[0], IDC_EDT_O_12, 0,0,0,0 },	// 12:僶僢僥儕乕廩1
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatCg2[0], IDC_EDT_O_13, 0,0,0,0 },	// 13:僶僢僥儕乕廩2
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatCg3[0], IDC_EDT_O_14, 0,0,0,0 },	// 14:僶僢僥儕乕廩3
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatCg4[0], IDC_EDT_O_15, 0,0,0,0 },	// 15:僶僢僥儕乕廩4
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatUc1[0], IDC_EDT_O_16, 0,0,0,0 },	// 16:僶僢僥儕乕曻1
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatUc2[0], IDC_EDT_O_17, 0,0,0,0 },	// 17:僶僢僥儕乕曻2
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatUc3[0], IDC_EDT_O_18, 0,0,0,0 },	// 18:僶僢僥儕乕曻3
		{ TYP_STR2, 5,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].BatUc4[0], IDC_EDT_O_19, 0,0,0,0 },	// 19:僶僢僥儕乕曻4
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].ReTryC[0], IDC_EDT_O_20, 0,0,0,0 },	// 20:儕僩儔僀夞悢
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].ReTryT[0], IDC_EDT_O_21, 0,0,0,0 },	// 21:儕僩儔僀娫妘
		{ TYP_STR2, 2,0, 0.0, 0.0, 0.0, (void*)&RcvPara[0].ComTye[0], IDC_EDT_O_22, 0,0,0,0 },	// 22:敪怣曽幃
		{ -1}
	#endif
};

CDlgEntParC::CDlgEntParC(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgEntParC::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgEntParC)
		// 儊儌 - ClassWizard 偼偙偺埵抲偵儅僢僺儞僌梡偺儅僋儘傪捛壛傑偨偼嶍彍偟傑偡丅
	//}}AFX_DATA_INIT
}

void CDlgEntParC::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgEntParC)
		// 儊儌 - ClassWizard 偼偙偺埵抲偵儅僢僺儞僌梡偺儅僋儘傪捛壛傑偨偼嶍彍偟傑偡丅
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CDlgEntParC, CDialog)
	//{{AFX_MSG_MAP(CDlgEntParC)
	ON_BN_CLICKED(IDC_BTN_PR01, OnBtnPr01)
	ON_BN_CLICKED(IDC_BTN_PR02, OnBtnPr02)
	ON_BN_CLICKED(IDC_BTN_PR03, OnBtnPr03)
	ON_WM_CLOSE()
	ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
	ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgEntParC 儊僢僙乕僕 僴儞僪儔

// 搊榐(&E)
void CDlgEntParC::OnBtnPr01()
{
	int err, a, cnt, len;
	CC_File cFile;

	OnSelchangeCombo1();
	::GetTblTxt(this, mTbl_P_Snd, -1, Ent_p * sizeof(struct	S_SND_PRM));
	OnSelchangeCombo1();

	cnt = -1;
	while (mTbl_P_Snd[++ cnt].typ != -1){
		len = mTbl_P_Snd[cnt].len;
		*((char*) mTbl_P_Snd[cnt].p+len+0) = 0x0d;
		*((char*) mTbl_P_Snd[cnt].p+len+1) = 0x0a;
	}
	for (a=0;a<36;a++){
		SetPara[Ent_p].sensit[a][6] = 0x0d;
		SetPara[Ent_p].sensit[a][7] = 0x0a;
	}

	// 曐懚
	err = cFile.C_ParaSave(1);		// 01:愝掕僷儔儊乕僞
	::PutTblTxt(this, mTbl_P_Snd, -1, Ent_p * sizeof(struct	S_SND_PRM));
}

// 報嶞(&P)
void CDlgEntParC::OnBtnPr02()
{
	Print_req = Disp.Num;
}

// 曉夞(&X)
void CDlgEntParC::OnBtnPr03()
{
	DspReqStack(DSP_EDT);
}

void CDlgEntParC::D_init()
{
	char buff[256];
	int a, c;
	CComboBox *pCmbBx1, *pCmbBx2;

	pOpenDlg = this;
/*
	cnt = -1;
	while (mTbl_P_Snd[++ cnt].typ != -1){
		len = mTbl_P_Snd[cnt].len;
		*((char*) mTbl_P_Snd[cnt].p+len) = 0;
	}
	for (a=0;a<36;a++){
		SetPara[Ent_p].sensit[a][6] = 0;
	}
*/
	pCmbBx1 = (CComboBox*) GetDlgItem(IDC_COMBO1);
	pCmbBx1->ResetContent();
	pCmbBx2 = (CComboBox*) GetDlgItem(IDC_COMBO2);
	pCmbBx2->ResetContent();
	for (a=0;a<36;a++){
		// 10-Jun-2004
		//sprintf(buff, "sensor %2d", a+1);
		sprintf(buff, "姶恔婍 %2d", a+1);
		pCmbBx1->InsertString(-1, buff);
		pCmbBx2->InsertString(-1, buff);
	}
	pCmbBx1->SetCurSel(1);
	pCmbBx2->SetCurSel(1);
	pCmbBx1->SetCurSel(0);
	pCmbBx2->SetCurSel(0);
	
	sprintf(buff, "屌桳斣崋 : %d    抂枛斣崋 : %d     抧揰柤 : %s",
			AdrEntDat[Ent_p].DevNum+1,
			AdrEntDat[Ent_p].TrmNo,
			AdrEntDat[Ent_p].AdrName
	);
	
	SetDlgItemText(IDC_STC_ADR, buff);

	for (a=0;a<MAX_CH;a++){
		c = -1;
		while (mTbl_P_Rcv[++ c].typ != -1){
			*((char *)mTbl_P_Rcv[c].p+sizeof(struct	S_RCV_PRM)*a+mTbl_P_Rcv[c].len) = 0;
		}
	}
	
	// TODO: 偙偺埵抲偵弶婜壔偺曗懌張棟傪捛壛偟偰偔偩偝偄
	::PutTblTxt(this, mTbl_P_Snd, -1, Ent_p * sizeof(struct	S_SND_PRM));
	::PutTblTxt(this, mTbl_P_Rcv, -1, Ent_p * sizeof(struct	S_RCV_PRM));
	SelChgCmb1(1);
	OnSelchangeCombo2();
}

BOOL CDlgEntParC::OnInitDialog() 
{
	CDialog::OnInitDialog();
	D_init();
	
	return TRUE;  // 僐儞僩儘乕儖偵僼僅乕僇僗傪愝掕偟側偄偲偒丄栠傝抣偼 TRUE 偲側傝傑偡
	              // 椺奜: OCX 僾儘僷僥傿 儁乕僕偺栠傝抣偼 FALSE 偲側傝傑偡
}

void CDlgEntParC::OnClose() 
{
	dialog_close(DSP_EDT);
	CDialog::OnOK();
}

void CDlgEntParC::SelChgCmb1(int _new)
{
	#if !ATSUGI
		int a, sel;
		static int old_s = -1;
		CComboBox*	pCmbBx;
		char buff[20];

		if (old_s != -1 && _new == 0){
			GetDlgItemText(IDC_EDT_I_23, buff, 6+1);
			buff[6] = 0;
			for (a=0;a<8;a++){
				SetPara[Ent_p].sensit[old_s][a] = buff[a];		// 僙儞僒乕1乣32 姶搙
			}
		}

		pCmbBx = (CComboBox*)GetDlgItem(IDC_COMBO1);
		sel = pCmbBx->GetCurSel();
		for (a=0;a<6;a++){
			buff[a] = SetPara[Ent_p].sensit[sel][a];			// 僙儞僒乕1乣32 姶搙
		}
		buff[a] = 0;
		SetDlgItemText(IDC_EDT_I_23, buff);
		old_s = sel;
	#endif
}

void CDlgEntParC::OnSelchangeCombo1()
{
	SelChgCmb1(0);
}

void CDlgEntParC::OnSelchangeCombo2() 
{
	#if !ATSUGI
		int a, sel;
		static int old_s = -1;
		CComboBox*	pCmbBx;
		char buff[20];

		pCmbBx = (CComboBox*)GetDlgItem(IDC_COMBO2);
		sel = pCmbBx->GetCurSel();
		for (a=0;a<6;a++){
			buff[a] = RcvPara[Ent_p].sensit[sel][a];			// 僙儞僒乕1乣32 姶搙
		}
		buff[a] = 0;
		SetDlgItemText(IDC_EDT_O_23, buff);
	#endif
}

// 僐僺乕
void CDlgEntParC::OnButton1()
{
	SetParCpy = SetPara[Ent_p];
}

// 揬傝晅偗
void CDlgEntParC::OnButton2()
{
	SetPara[Ent_p] = SetParCpy;
	D_init();
}

// all
void CDlgEntParC::OnButton3() 
{
	#if !ATSUGI
		int a;
		static int old_s = -1;
		char buff[20];

		GetDlgItemText(IDC_EDT_I_23, buff, 6+1);
		buff[6] = 0;
		for (a=0;a<36;a++){
			sprintf(SetPara[Ent_p].sensit[a], buff);
		}
	#endif
}

⌨️ 快捷键说明

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