form_CFGCommon.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:25k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * form_CFGcommon.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * common CFG file source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "form_CFGCommon.h"
- #include "META_Factory.h"
- #include "meta_utils.h"
- #include "misc.h"
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmCFGCommon *frmCFGCommon;
- //static int Default_ARFCN[] = { 0, 512, 512, 128, 276 }; // GSM, DCS, PCS, GSM850, GSM400
- //---------------------------------------------------------------------------
- __fastcall TfrmCFGCommon::TfrmCFGCommon(TComponent* Owner)
- : TForm(Owner)
- {
- // GPIB address
- i_GPIB_Addr[0] = i_8960_GPIB_Addr;
- i_GPIB_Addr[1] = i_CMU200_GPIB_Addr;
- // cable loss
- d_CL[AGILENT_8960_CL][0] = d_GSM400_CL;
- d_CL[AGILENT_8960_CL][1] = d_GSM850_CL;
- d_CL[AGILENT_8960_CL][2] = d_GSM900_CL;
- d_CL[AGILENT_8960_CL][3] = d_DCS1800_CL;
- d_CL[AGILENT_8960_CL][4] = d_PCS1900_CL;
- d_CL[CMU_200_INPUT_CL][0] = d_CMU200_INPUT_GSM400_CL;
- d_CL[CMU_200_INPUT_CL][1] = d_CMU200_INPUT_GSM850_CL;
- d_CL[CMU_200_INPUT_CL][2] = d_CMU200_INPUT_GSM900_CL;
- d_CL[CMU_200_INPUT_CL][3] = d_CMU200_INPUT_DCS1800_CL;
- d_CL[CMU_200_INPUT_CL][4] = d_CMU200_INPUT_PCS1900_CL;
- d_CL[CMU_200_OUTPUT_CL][0] = d_CMU200_OUTPUT_GSM400_CL;
- d_CL[CMU_200_OUTPUT_CL][1] = d_CMU200_OUTPUT_GSM850_CL;
- d_CL[CMU_200_OUTPUT_CL][2] = d_CMU200_OUTPUT_GSM900_CL;
- d_CL[CMU_200_OUTPUT_CL][3] = d_CMU200_OUTPUT_DCS1800_CL;
- d_CL[CMU_200_OUTPUT_CL][4] = d_CMU200_OUTPUT_PCS1900_CL;
- // CO ARFCN
- m_sARFCN_C0[0] = m_sARFCN_C0_GSM;
- m_sARFCN_C0[1] = m_sARFCN_C0_DCS;
- m_sARFCN_C0[2] = m_sARFCN_C0_PCS;
- m_sARFCN_C0[3] = m_sARFCN_C0_GSM850;
- m_sARFCN_C0[4] = m_sARFCN_C0_GSM400;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtGPIBAddressCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " GPIB address is not valid ";
- text = edit->Text;
- if( !IsValidGPIBAddr( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 15 );
- edit->SetFocus();
- return;
- }
- i_GPIB_Addr[edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtTimeOutCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " Timeout is not valid ";
- text = edit->Text;
- if( !IsValidTimeout( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 5000 );
- edit->SetFocus();
- return;
- }
- i_TimeOut[edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtCableLossCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " Cable loss is not valid ";
- text = edit->Text;
- if( !IsValidCableLoss( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 0 );
- edit->SetFocus();
- return;
- }
- d_CL[AGILENT_8960_CL][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtInputCableLossCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " Cable loss is not valid ";
- text = edit->Text;
- if( !IsValidCableLoss( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 0 );
- edit->SetFocus();
- return;
- }
- d_CL[CMU_200_INPUT_CL][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtOutputCableLossCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " Cable loss is not valid ";
- text = edit->Text;
- if( !IsValidCableLoss( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( 0 );
- edit->SetFocus();
- return;
- }
- d_CL[CMU_200_OUTPUT_CL][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtARFCNCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 0~124 or 975~1023 ", // GSM
- " value shall be 512~885 ", // DCS
- " value shall be 512~810 ", // PCS
- " value shall be 128~251 ", // GSM850
- " value shall be 259~293 " // GSM450
- };
- E_BANDSEL CurBand = (E_BANDSEL) edit->Tag;
- text = edit->Text;
- if (!IsValidARFCN(text, CurBand, sdata))
- {
- edit->Text = IntToStr(Default_ARFCN[CurBand]);
- ShowHintLabel(edit, hint[CurBand]);
- edit->SetFocus();
- return;
- }
- m_sARFCN_C0[edit->Tag] = sdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::edtP_DLCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " P_DL is not valid ";
- text = edit->Text;
- if( !IsValidPower( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Double_To_AnsiString( -60 );
- edit->SetFocus();
- return;
- }
- d_P_DL = data;
- }
- //---------------------------------------------------------------------------
- bool TfrmCFGCommon::CheckFields( void )
- {
- AnsiString text;
- char buf[20];
- // 8960 Initialization
- text = edt8960GPIBAddress->Text; if( !IsValidGPIBAddr( text, i_8960_GPIB_Addr ) ) { edtGPIBAddressCheck(edt8960GPIBAddress); return(false); }
- cfg->setGPIB_Addr( "GPIB0::" + IntToStr(i_8960_GPIB_Addr) + "::INSTR" );
- text = edtTimeOut8960->Text; if( !IsValidTimeout( text, i_8960_TimeOut ) ) { edtTimeOutCheck(edtTimeOut8960); return(false); }
- cfg->setTimeOut( i_8960_TimeOut );
- text = edtGSM400CableLoss->Text; if( !IsValidCableLoss( text, d_GSM400_CL ) ) { edtCableLossCheck(edtGSM400CableLoss); return(false); }
- cfg->setGSM400_CableLoss( d_GSM400_CL );
- text = edtGSM850CableLoss->Text; if( !IsValidCableLoss( text, d_GSM850_CL ) ) { edtCableLossCheck(edtGSM850CableLoss); return(false); }
- cfg->setGSM850_CableLoss( d_GSM850_CL );
- text = edtGSM900CableLoss->Text; if( !IsValidCableLoss( text, d_GSM900_CL ) ) { edtCableLossCheck(edtGSM900CableLoss); return(false); }
- cfg->setGSM900_CableLoss( d_GSM900_CL );
- text = edtDCS1800CableLoss->Text; if( !IsValidCableLoss( text, d_DCS1800_CL ) ) { edtCableLossCheck(edtDCS1800CableLoss); return(false); }
- cfg->setDCS1800_CableLoss( d_DCS1800_CL );
- text = edtPCS1900CableLoss->Text; if( !IsValidCableLoss( text, d_PCS1900_CL ) ) { edtCableLossCheck(edtPCS1900CableLoss); return(false); }
- cfg->setPCS1900_CableLoss( d_PCS1900_CL );
- // CMU200 Initialization
- text = edtCMU200GPIBAddress->Text; if( !IsValidGPIBAddr( text, i_CMU200_GPIB_Addr ) ) { edtGPIBAddressCheck(edtCMU200GPIBAddress); return(false); }
- cfg->setCMU200_GPIB_Addr( "GPIB0::" + IntToStr(i_CMU200_GPIB_Addr) + "::INSTR" );
- text = edtTimeOutCMU200->Text; if( !IsValidTimeout( text, i_CMU200_TimeOut ) ) { edtTimeOutCheck(edtTimeOutCMU200); return(false); }
- cfg->setCMU200_TimeOut( i_CMU200_TimeOut );
- text = edtGSM400InputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_INPUT_GSM400_CL ) ) { edtCableLossCheck(edtGSM400InputCableLoss); return(false); }
- cfg->setCMU200_INPUT_GSM400_CableLoss( d_CMU200_INPUT_GSM400_CL );
- text = edtGSM850InputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_INPUT_GSM850_CL ) ) { edtCableLossCheck(edtGSM850InputCableLoss); return(false); }
- cfg->setCMU200_INPUT_GSM850_CableLoss( d_CMU200_INPUT_GSM850_CL );
- text = edtGSM900InputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_INPUT_GSM900_CL ) ) { edtCableLossCheck(edtGSM900InputCableLoss); return(false); }
- cfg->setCMU200_INPUT_GSM900_CableLoss( d_CMU200_INPUT_GSM900_CL );
- text = edtDCS1800InputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_INPUT_DCS1800_CL ) ) { edtCableLossCheck(edtDCS1800InputCableLoss); return(false); }
- cfg->setCMU200_INPUT_DCS1800_CableLoss( d_CMU200_INPUT_DCS1800_CL );
- text = edtPCS1900InputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_INPUT_PCS1900_CL ) ) { edtCableLossCheck(edtPCS1900InputCableLoss); return(false); }
- cfg->setCMU200_INPUT_PCS1900_CableLoss( d_CMU200_INPUT_PCS1900_CL );
- text = edtGSM400OutputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_OUTPUT_GSM400_CL ) ) { edtCableLossCheck(edtGSM400OutputCableLoss); return(false); }
- cfg->setCMU200_OUTPUT_GSM400_CableLoss( d_CMU200_OUTPUT_GSM400_CL );
- text = edtGSM850OutputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_OUTPUT_GSM850_CL ) ) { edtCableLossCheck(edtGSM850OutputCableLoss); return(false); }
- cfg->setCMU200_OUTPUT_GSM850_CableLoss( d_CMU200_OUTPUT_GSM850_CL );
- text = edtGSM900OutputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_OUTPUT_GSM900_CL ) ) { edtCableLossCheck(edtGSM900OutputCableLoss); return(false); }
- cfg->setCMU200_OUTPUT_GSM900_CableLoss( d_CMU200_OUTPUT_GSM900_CL );
- text = edtDCS1800OutputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_OUTPUT_DCS1800_CL ) ) { edtCableLossCheck(edtDCS1800OutputCableLoss); return(false); }
- cfg->setCMU200_OUTPUT_DCS1800_CableLoss( d_CMU200_OUTPUT_DCS1800_CL );
- text = edtPCS1900OutputCableLoss->Text; if( !IsValidCableLoss( text, d_CMU200_OUTPUT_PCS1900_CL ) ) { edtCableLossCheck(edtPCS1900OutputCableLoss); return(false); }
- cfg->setCMU200_OUTPUT_PCS1900_CableLoss( d_CMU200_OUTPUT_PCS1900_CL );
- // frequency bank
- setFrequencyBank();
- sprintf(buf, "%x", i_FreqBank );
- if( i_FreqBank <= 16 )
- {
- cfg->setFreqBank( "0x0" +(AnsiString) buf );
- }
- else
- {
- cfg->setFreqBank( "0x" +(AnsiString) buf );
- }
- // C0 for each Bank
- text = edtArfcn_C0_GSM400->Text; if( !IsValidARFCN( text, BANDSEL_GSM400, m_sARFCN_C0_GSM400 ) ) { edtARFCNCheck(edtArfcn_C0_GSM400); return(false); }
- cfg->setARFCN_C0_GSM400( m_sARFCN_C0_GSM400 );
- text = edtArfcn_C0_GSM850->Text; if( !IsValidARFCN( text, BANDSEL_GSM850, m_sARFCN_C0_GSM850 ) ) { edtARFCNCheck(edtArfcn_C0_GSM850); return(false); }
- cfg->setARFCN_C0_GSM850( m_sARFCN_C0_GSM850 );
- text = edtArfcn_C0_GSM->Text; if( !IsValidARFCN( text, BANDSEL_GSM900, m_sARFCN_C0_GSM ) ) { edtARFCNCheck(edtArfcn_C0_GSM); return(false); }
- cfg->setARFCN_C0_GSM( m_sARFCN_C0_GSM );
- text = edtArfcn_C0_DCS->Text; if( !IsValidARFCN( text, BANDSEL_DCS1800, m_sARFCN_C0_DCS ) ) { edtARFCNCheck(edtArfcn_C0_DCS); return(false); }
- cfg->setARFCN_C0_DCS( m_sARFCN_C0_DCS );
- text = edtArfcn_C0_PCS->Text; if( !IsValidARFCN( text, BANDSEL_PCS1900, m_sARFCN_C0_PCS ) ) { edtARFCNCheck(edtArfcn_C0_PCS); return(false); }
- cfg->setARFCN_C0_PCS( m_sARFCN_C0_PCS );
- // Downlink power
- text = edtP_DL->Text; if( !IsValidPower( text, d_P_DL ) ) { edtP_DLCheck(edtP_DL); return(false); }
- cfg->setP_DL( d_P_DL );
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void TfrmCFGCommon::ShowHintLabel( TControl *sender, char* hint )
- {
- TPoint pt0 = this->ClientOrigin;
- TPoint pt1 = sender->ClientOrigin;
- lblHint->Left = (pt1.x-pt0.x);
- lblHint->Top = (pt1.y-pt0.y)+sender->Height+3;
- lblHint->Caption = hint;
- lblHint->Visible = true;
- HintTimer->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::btnSaveToCFGFileClick(TObject *Sender)
- {
- bool ok;
- int i;
- AnsiString asPath, asFileName;
- static bool isFirstSave = true;
- if( isFirstSave )
- {
- isFirstSave = false;
- if( getPathFromStr( frmFatcory->stCFGFile->Caption, asPath ) )
- {
- SaveDlg->InitialDir = asPath;
- if( getFilenameFromStr( frmFatcory->stCFGFile->Caption, asFileName ) )
- {
- SaveDlg->FileName = asFileName;
- }
- }
- else
- {
- if( getPathFromStr(Application->ExeName, asPath) )
- {
- SaveDlg->InitialDir = asPath;
- }
- else
- {
- SaveDlg->InitialDir = "C:\";
- }
- }
- }
- if( ! CheckFields() )
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Save common parameter setting to file fail";
- Application->MessageBox( "Execution Failure : Save common parameter setting to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDlg->Execute();
- if( !ok )
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Save common parameter setting to file fail";
- Application->MessageBox( "Execution Failure : Save common parameter setting to file", "FAILURE", MB_OK );
- return;
- }
- cfg->SaveCommonToCfgFile( SaveDlg->FileName );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if(cfg != NULL)
- {
- delete cfg;
- cfg = NULL;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmCFGCommon::setFrequencyBank( void )
- {
- i_FreqBank = 0;
- if( cbGSM400->Checked )
- {
- i_FreqBank |= FREQUENCY_BANK_GSM_400;
- }
- if( cbGSM850->Checked )
- {
- i_FreqBank |= FREQUENCY_BANK_GSM_850;
- }
- if( cbGSM900->Checked )
- {
- i_FreqBank |= FREQUENCY_BANK_GSM_900;
- }
- if( cbDCS1800->Checked )
- {
- i_FreqBank |= FREQUENCY_BANK_DCS_1800;
- }
- if( cbPCS1900->Checked )
- {
- i_FreqBank |= FREQUENCY_BANK_PCS_1900;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGCommon::btnLoadFromCFGFileClick(TObject *Sender)
- {
- bool ok;
- int i;
- AnsiString asPath, asFileName;
- AnsiString as_8960_GPIB_Addr, as_CMU200_GPIB_Addr;
- AnsiString as_FreqBank;
- static bool isFirstOpen = true;
- if( isFirstOpen )
- {
- isFirstOpen = false;
- if( getPathFromStr( frmFatcory->stCFGFile->Caption, asPath ) )
- {
- OpenDlg->InitialDir = asPath;
- if( getFilenameFromStr( frmFatcory->stCFGFile->Caption, asFileName ) )
- {
- OpenDlg->FileName = asFileName;
- }
- }
- else
- {
- if( getPathFromStr(Application->ExeName, asPath) )
- {
- OpenDlg->InitialDir = asPath;
- }
- else
- {
- OpenDlg->InitialDir = "C:\";
- }
- }
- }
- ok = OpenDlg->Execute();
- if( !ok )
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Load common parameter setting from file fail";
- Application->MessageBox( "Execution Failure : Load common parameter setting from file fail", "FAILURE", MB_OK );
- return;
- }
- if (!cfg->ReadFromIniFile(OpenDlg->FileName))
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Read CFG file fail";
- Application->MessageBox( "Execution Failure : Read CFG file", "FAILURE", MB_OK );
- return;
- }
- // 8960 GPIB Address
- cfg->getGPIB_Addr( as_8960_GPIB_Addr );
- if( ! getGPIBAddrNumFromStr( as_8960_GPIB_Addr, i_8960_GPIB_Addr) )
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Get 8960 GPIB Address from file fail";
- Application->MessageBox( "Execution Failure : Get 8960 GPIB Address from file fail", "FAILURE", MB_OK );
- return;
- }
- edt8960GPIBAddress->Text = IntToStr( i_8960_GPIB_Addr );
- // Time Out
- cfg->getTimeOut( i_8960_TimeOut );
- edtTimeOut8960->Text = IntToStr( i_8960_TimeOut );
- // GSM400 cable loss
- cfg->getGSM400_CableLoss( d_GSM400_CL );
- edtGSM400CableLoss->Text = Double_To_AnsiString( d_GSM400_CL );
- // GSM850 cable loss
- cfg->getGSM850_CableLoss( d_GSM850_CL );
- edtGSM850CableLoss->Text = Double_To_AnsiString( d_GSM850_CL );
- // GSM900 cable loss
- cfg->getGSM900_CableLoss( d_GSM900_CL );
- edtGSM900CableLoss->Text = Double_To_AnsiString( d_GSM900_CL );
- // DCS1800 cable loss
- cfg->getDCS1800_CableLoss( d_DCS1800_CL );
- edtDCS1800CableLoss->Text = Double_To_AnsiString( d_DCS1800_CL );
- // PCS1900 cable loss
- cfg->getPCS1900_CableLoss( d_PCS1900_CL );
- edtPCS1900CableLoss->Text = Double_To_AnsiString( d_PCS1900_CL );
- // CMU200 Initialization
- // CMU200 GPIB Address
- cfg->getCMU200_GPIB_Addr( as_CMU200_GPIB_Addr );
- if( ! getGPIBAddrNumFromStr( as_CMU200_GPIB_Addr, i_CMU200_GPIB_Addr) )
- {
- sbCFGCommon->Panels->Items[0]->Text = (AnsiString) " Get CMU200 GPIB Address from file fail";
- Application->MessageBox( "Execution Failure : Get CMU200 GPIB Address from file fail", "FAILURE", MB_OK );
- return;
- }
- edtCMU200GPIBAddress->Text = IntToStr( i_CMU200_GPIB_Addr );
- // Time Out
- cfg->getCMU200_TimeOut( i_CMU200_TimeOut );
- edtTimeOutCMU200->Text = IntToStr( i_CMU200_TimeOut );
- // GSM400 input cable loss
- cfg->getCMU200_INPUT_GSM400_CableLoss( d_CMU200_INPUT_GSM400_CL );
- edtGSM400InputCableLoss->Text = Double_To_AnsiString( d_CMU200_INPUT_GSM400_CL );
- // GSM850 input cable loss
- cfg->getCMU200_INPUT_GSM850_CableLoss( d_CMU200_INPUT_GSM850_CL );
- edtGSM850InputCableLoss->Text = Double_To_AnsiString( d_CMU200_INPUT_GSM850_CL );
- // GSM900 input cable loss
- cfg->getCMU200_INPUT_GSM900_CableLoss( d_CMU200_INPUT_GSM900_CL );
- edtGSM900InputCableLoss->Text = Double_To_AnsiString( d_CMU200_INPUT_GSM900_CL );
- // DCS1800 input cable loss
- cfg->getCMU200_INPUT_DCS1800_CableLoss( d_CMU200_INPUT_DCS1800_CL );
- edtDCS1800InputCableLoss->Text = Double_To_AnsiString( d_CMU200_INPUT_DCS1800_CL );
- // PCS1900 input cable loss
- cfg->getCMU200_INPUT_PCS1900_CableLoss( d_CMU200_INPUT_PCS1900_CL );
- edtPCS1900InputCableLoss->Text = Double_To_AnsiString( d_CMU200_INPUT_PCS1900_CL );
- // GSM400 output cable loss
- cfg->getCMU200_OUTPUT_GSM400_CableLoss( d_CMU200_OUTPUT_GSM400_CL );
- edtGSM400OutputCableLoss->Text = Double_To_AnsiString( d_CMU200_OUTPUT_GSM400_CL );
- // GSM850 output cable loss
- cfg->getCMU200_OUTPUT_GSM850_CableLoss( d_CMU200_OUTPUT_GSM850_CL );
- edtGSM850OutputCableLoss->Text = Double_To_AnsiString( d_CMU200_OUTPUT_GSM850_CL );
- // GSM900 output cable loss
- cfg->getCMU200_OUTPUT_GSM900_CableLoss( d_CMU200_OUTPUT_GSM900_CL );
- edtGSM900OutputCableLoss->Text = Double_To_AnsiString( d_CMU200_OUTPUT_GSM900_CL );
- // DCS1800 output cable loss
- cfg->getCMU200_OUTPUT_DCS1800_CableLoss( d_CMU200_OUTPUT_DCS1800_CL );
- edtDCS1800OutputCableLoss->Text = Double_To_AnsiString( d_CMU200_OUTPUT_DCS1800_CL );
- // PCS1900 output cable loss
- cfg->getCMU200_OUTPUT_PCS1900_CableLoss( d_CMU200_OUTPUT_PCS1900_CL );
- edtPCS1900OutputCableLoss->Text = Double_To_AnsiString( d_CMU200_OUTPUT_PCS1900_CL );
- // frequency bank
- cfg->getFreqBank( as_FreqBank );
- i_FreqBank = as_FreqBank.ToInt();
- DisplayFreqBank(i_FreqBank);
- // C0 for each Bank
- // arfcn_C0_GSM400
- cfg->getARFCN_C0_GSM400( m_sARFCN_C0_GSM400 );
- edtArfcn_C0_GSM400->Text = IntToStr( m_sARFCN_C0_GSM400 );
- // arfcn_C0_GSM850
- cfg->getARFCN_C0_GSM850( m_sARFCN_C0_GSM850 );
- edtArfcn_C0_GSM850->Text = IntToStr( m_sARFCN_C0_GSM850 );
- // arfcn_C0_GSM
- cfg->getARFCN_C0_GSM( m_sARFCN_C0_GSM );
- edtArfcn_C0_GSM->Text = IntToStr( m_sARFCN_C0_GSM );
- // arfcn_C0_DCS
- cfg->getARFCN_C0_DCS( m_sARFCN_C0_DCS );
- edtArfcn_C0_DCS->Text = IntToStr( m_sARFCN_C0_DCS );
- // arfcn_C0_PCS
- cfg->getARFCN_C0_PCS( m_sARFCN_C0_PCS );
- edtArfcn_C0_PCS->Text = IntToStr( m_sARFCN_C0_PCS );
- // Downlink power
- cfg->getP_DL( d_P_DL );
- edtP_DL->Text = Double_To_AnsiString( d_P_DL );
- }
- //---------------------------------------------------------------------------
- void TfrmCFGCommon::DisplayFreqBank( int i_FreqBank )
- {
- int mask;
- mask = FREQUENCY_BANK_GSM_400;
- if( i_FreqBank & mask )
- {
- cbGSM400->Checked = true;
- }
- else
- {
- cbGSM400->Checked = false;
- }
- mask = FREQUENCY_BANK_GSM_850;
- if( i_FreqBank & mask )
- {
- cbGSM850->Checked = true;
- }
- else
- {
- cbGSM850->Checked = false;
- }
- mask = FREQUENCY_BANK_GSM_900;
- if( i_FreqBank & mask )
- {
- cbGSM900->Checked = true;
- }
- else
- {
- cbGSM900->Checked = false;
- }
- mask = FREQUENCY_BANK_DCS_1800;
- if( i_FreqBank & mask )
- {
- cbDCS1800->Checked = true;
- }
- else
- {
- cbDCS1800->Checked = false;
- }
- mask = FREQUENCY_BANK_PCS_1900;
- if( i_FreqBank & mask )
- {
- cbPCS1900->Checked = true;
- }
- else
- {
- cbPCS1900->Checked = false;
- }
- }
- void __fastcall TfrmCFGCommon::FormShow(TObject *Sender)
- {
- if(cfg == NULL)
- {
- cfg = new TMETA_factory_cfg();
- }
- }
- //---------------------------------------------------------------------------