form_CFGTxPcl.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:33k
- /*****************************************************************************
- * 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_CFGTxPcl.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * TX PCL CFG form 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_CFGTxPcl.h"
- #include "META_Factory.h"
- #include "META_factory_cfg.h"
- #include "meta_utils.h"
- // misc
- #include "misc.h"
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmCFGTxPcl *frmCFGTxPcl;
- //static int Default_PCL = 10;
- //---------------------------------------------------------------------------
- __fastcall TfrmCFGTxPcl::TfrmCFGTxPcl(TComponent* Owner)
- : TForm(Owner)
- {
- int i, j;
- edtCAL_PCL[0] = edtCAL_PCL0;
- edtCAL_PCL[1] = edtCAL_PCL1;
- edtCAL_PCL[2] = edtCAL_PCL2;
- edtPCL[ 0] = edtPCL00;
- edtPCL[ 1] = edtPCL01;
- edtPCL[ 2] = edtPCL02;
- edtPCL[ 3] = edtPCL03;
- edtPCL[ 4] = edtPCL04;
- edtPCL[ 5] = edtPCL05;
- edtPCL[ 6] = edtPCL06;
- edtPCL[ 7] = edtPCL07;
- edtPCL[ 8] = edtPCL08;
- edtPCL[ 9] = edtPCL09;
- edtPCL[10] = edtPCL10;
- edtPCL[11] = edtPCL11;
- edtPCL[12] = edtPCL12;
- edtPCL[13] = edtPCL13;
- edtPCL[14] = edtPCL14;
- edtPCL[15] = edtPCL15;
- edtCHECK_PCL[ 0] = edtCHECK_PCL00;
- edtCHECK_PCL[ 1] = edtCHECK_PCL01;
- edtCHECK_PCL[ 2] = edtCHECK_PCL02;
- edtCHECK_PCL[ 3] = edtCHECK_PCL03;
- edtCHECK_PCL[ 4] = edtCHECK_PCL04;
- edtCHECK_PCL[ 5] = edtCHECK_PCL05;
- edtCHECK_PCL[ 6] = edtCHECK_PCL06;
- edtCHECK_PCL[ 7] = edtCHECK_PCL07;
- edtCHECK_PCL[ 8] = edtCHECK_PCL08;
- edtCHECK_PCL[ 9] = edtCHECK_PCL09;
- edtCHECK_PCL[10] = edtCHECK_PCL10;
- edtCHECK_PCL[11] = edtCHECK_PCL11;
- edtCHECK_PCL[12] = edtCHECK_PCL12;
- edtCHECK_PCL[13] = edtCHECK_PCL13;
- edtCHECK_PCL[14] = edtCHECK_PCL14;
- edtCHECK_PCL[15] = edtCHECK_PCL15;
- edtMAX_P[ 0] = edtMAX_P00;
- edtMAX_P[ 1] = edtMAX_P01;
- edtMAX_P[ 2] = edtMAX_P02;
- edtMAX_P[ 3] = edtMAX_P03;
- edtMAX_P[ 4] = edtMAX_P04;
- edtMAX_P[ 5] = edtMAX_P05;
- edtMAX_P[ 6] = edtMAX_P06;
- edtMAX_P[ 7] = edtMAX_P07;
- edtMAX_P[ 8] = edtMAX_P08;
- edtMAX_P[ 9] = edtMAX_P09;
- edtMAX_P[10] = edtMAX_P10;
- edtMAX_P[11] = edtMAX_P11;
- edtMAX_P[12] = edtMAX_P12;
- edtMAX_P[13] = edtMAX_P13;
- edtMAX_P[14] = edtMAX_P14;
- edtMAX_P[15] = edtMAX_P15;
- edtWANTED_P[ 0] = edtWANTED_P00;
- edtWANTED_P[ 1] = edtWANTED_P01;
- edtWANTED_P[ 2] = edtWANTED_P02;
- edtWANTED_P[ 3] = edtWANTED_P03;
- edtWANTED_P[ 4] = edtWANTED_P04;
- edtWANTED_P[ 5] = edtWANTED_P05;
- edtWANTED_P[ 6] = edtWANTED_P06;
- edtWANTED_P[ 7] = edtWANTED_P07;
- edtWANTED_P[ 8] = edtWANTED_P08;
- edtWANTED_P[ 9] = edtWANTED_P09;
- edtWANTED_P[10] = edtWANTED_P10;
- edtWANTED_P[11] = edtWANTED_P11;
- edtWANTED_P[12] = edtWANTED_P12;
- edtWANTED_P[13] = edtWANTED_P13;
- edtWANTED_P[14] = edtWANTED_P14;
- edtWANTED_P[15] = edtWANTED_P15;
- edtMIN_P[ 0] = edtMIN_P00;
- edtMIN_P[ 1] = edtMIN_P01;
- edtMIN_P[ 2] = edtMIN_P02;
- edtMIN_P[ 3] = edtMIN_P03;
- edtMIN_P[ 4] = edtMIN_P04;
- edtMIN_P[ 5] = edtMIN_P05;
- edtMIN_P[ 6] = edtMIN_P06;
- edtMIN_P[ 7] = edtMIN_P07;
- edtMIN_P[ 8] = edtMIN_P08;
- edtMIN_P[ 9] = edtMIN_P09;
- edtMIN_P[10] = edtMIN_P10;
- edtMIN_P[11] = edtMIN_P11;
- edtMIN_P[12] = edtMIN_P12;
- edtMIN_P[13] = edtMIN_P13;
- edtMIN_P[14] = edtMIN_P14;
- edtMIN_P[15] = edtMIN_P15;
- edtC[ 0] = edtC00;
- edtC[ 1] = edtC01;
- edtC[ 2] = edtC02;
- edtC[ 3] = edtC03;
- edtC[ 4] = edtC04;
- edtC[ 5] = edtC05;
- edtC[ 6] = edtC06;
- edtC[ 7] = edtC07;
- edtC[ 8] = edtC08;
- edtC[ 9] = edtC09;
- edtC[10] = edtC10;
- edtC[11] = edtC11;
- edtC[12] = edtC12;
- edtC[13] = edtC13;
- edtC[14] = edtC14;
- edtC[15] = edtC15;
- edtCORRECTION[ 0] = edtCORRECTION00;
- edtCORRECTION[ 1] = edtCORRECTION01;
- edtCORRECTION[ 2] = edtCORRECTION02;
- edtCORRECTION[ 3] = edtCORRECTION03;
- edtCORRECTION[ 4] = edtCORRECTION04;
- edtCORRECTION[ 5] = edtCORRECTION05;
- edtCORRECTION[ 6] = edtCORRECTION06;
- edtCORRECTION[ 7] = edtCORRECTION07;
- edtCORRECTION[ 8] = edtCORRECTION08;
- edtCORRECTION[ 9] = edtCORRECTION09;
- edtCORRECTION[10] = edtCORRECTION10;
- edtCORRECTION[11] = edtCORRECTION11;
- edtCORRECTION[12] = edtCORRECTION12;
- edtCORRECTION[13] = edtCORRECTION13;
- edtCORRECTION[14] = edtCORRECTION14;
- edtCORRECTION[15] = edtCORRECTION15;
- for( i=0; i<5; i++ )
- {
- for( j=0; j<3; j++ )
- {
- i_CAL_PCL[i][j] = 10;
- }
- }
- for( i=0; i<5; i++ )
- {
- for( j=0; j<16; j++ )
- {
- i_PCL[i][j] = 10;
- i_CHECK_PCL[i][j] = 10;
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if(cfg != NULL)
- {
- delete cfg;
- cfg = NULL;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmCFGTxPcl::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 TfrmCFGTxPcl::edtCAL_PCLCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 4~31 ", // GSM400
- " value shall be 4~31 ", // GSM850
- " value shall be 4~31 ", // GSM900
- " value shall be 0~28 ", // DCS1800
- " value shall be 0~15 ", // PCS1900
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGPCL( text, CurBand, data ) )
- { ShowHintLabel( edit, hint[CurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- i_CHECK_PCL[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtPCLCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 4~31 ", // GSM400
- " value shall be 4~31 ", // GSM850
- " value shall be 4~31 ", // GSM900
- " value shall be 0~28 ", // DCS1800
- " value shall be 0~15 ", // PCS1900
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGPCL( text, CurBand, data ) )
- { ShowHintLabel( edit, hint[CurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- i_PCL[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtCHECK_PCLCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 4~31 ", // GSM400
- " value shall be 4~31 ", // GSM850
- " value shall be 4~31 ", // GSM900
- " value shall be 0~28 ", // DCS1800
- " value shall be 0~15 ", // PCS1900
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGPCL( text, CurBand, data ) )
- { ShowHintLabel( edit, hint[CurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- i_CHECK_PCL[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtMAX_PCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGMAX_P( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_MAX_P[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtWANTED_PCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGWANTED_P( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_WANTED_P[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtMIN_PCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGMIN_P( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_MIN_P[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtCCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGC( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_C[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtCORRECTIONCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGCORRECTION( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_CORRECTION[CurBand][edit->Tag] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtRecursiveTimesCheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGRecursiveTimes( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- i_Recursive_Times = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtTSCCheck(TObject *Sender)
- {
- char c_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- text = edit->Text;
- if (!IsValidCFGTSC(text, c_data))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- c_TSC = c_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::edtAPCDeltaCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] =
- {
- " value is not valid "
- };
- // CurBand = tctlAPC->TabIndex;
- text = edit->Text;
- if( !IsValidCFGAPCDelta( text, data ) )
- { ShowHintLabel( edit, hint );
- // edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- d_APC_Delta = data;
- }
- //---------------------------------------------------------------------------
- bool TfrmCFGTxPcl::CheckFields( void )
- {
- int i;
- int i_data[10][16];
- double d_data[10][16];
- //int band = CurBand;
- AnsiString text;
- for(i=0; i<3; i++)
- {
- text = edtCAL_PCL[i]->Text; if( !IsValidCFGPCL( text, CurBand, i_data[0][i] ) ) { edtCAL_PCLCheck(edtCAL_PCL[i]); return(false); }
- }
- for(i=0; i<16; i++)
- {
- text = edtPCL[i]->Text; if( !IsValidCFGPCL( text, CurBand, i_data[0][i] ) ) { edtPCLCheck(edtPCL[i]); return(false); }
- text = edtCHECK_PCL[i]->Text; if( !IsValidCFGPCL( text, CurBand, i_data[0][i] ) ) { edtCHECK_PCLCheck(edtCHECK_PCL[i]); return(false); }
- text = edtMAX_P[i]->Text; if( !IsValidCFGMAX_P( text, d_data[0][i] ) ) { edtMAX_PCheck(edtMAX_P[i]); return(false); }
- text = edtWANTED_P[i]->Text; if( !IsValidCFGWANTED_P( text, d_data[0][i] ) ) { edtWANTED_PCheck(edtWANTED_P[i]); return(false); }
- text = edtMIN_P[i]->Text; if( !IsValidCFGMIN_P( text, d_data[0][i] ) ) { edtMIN_PCheck(edtMIN_P[i]); return(false); }
- text = edtC[i]->Text; if( !IsValidCFGC( text, d_data[0][i] ) ) { edtCCheck(edtC[i]); return(false); }
- text = edtCORRECTION[i]->Text; if( !IsValidCFGCORRECTION( text, d_data[0][i] ) ) { edtCORRECTIONCheck(edtC[i]); return(false); }
- }
- text = edtTSC->Text; if( !IsValidCFGTSC( text, c_TSC ) ) { edtTSCCheck(edtTSC); return(false); }
- text = edtRecursiveTimes->Text; if( !IsValidCFGRecursiveTimes( text, i_Recursive_Times ) ) { edtRecursiveTimesCheck(edtRecursiveTimes); return(false); }
- text = edtAPCDelta->Text; if( !IsValidCFGAPCDelta( text, d_APC_Delta ) ) { edtRecursiveTimesCheck(edtAPCDelta); return(false); }
- if( 0 == cbAPCCheck->ItemIndex ) m_bAPCCheck = true;
- else m_bAPCCheck = false;
- return(true);
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::btnLoadFromCFGFileClick(TObject *Sender)
- {
- bool ok;
- int i;
- AnsiString asPath, asFileName;
- AnsiString as_GSM400_CAL_PCL;
- AnsiString as_GSM850_CAL_PCL;
- AnsiString as_GSM900_CAL_PCL;
- AnsiString as_DCS1800_CAL_PCL;
- AnsiString as_PCS1900_CAL_PCL;
- AnsiString as_GSM400_2CAL_PCL;
- AnsiString as_GSM850_2CAL_PCL;
- AnsiString as_GSM900_2CAL_PCL;
- AnsiString as_DCS1800_2CAL_PCL;
- AnsiString as_PCS1900_2CAL_PCL;
- AnsiString as_GSM400_PCL;
- AnsiString as_GSM850_PCL;
- AnsiString as_GSM900_PCL;
- AnsiString as_DCS1800_PCL;
- AnsiString as_PCS1900_PCL;
- AnsiString as_GSM400_CHECK_PCL;
- AnsiString as_GSM850_CHECK_PCL;
- AnsiString as_GSM900_CHECK_PCL;
- AnsiString as_DCS1800_CHECK_PCL;
- AnsiString as_PCS1900_CHECK_PCL;
- AnsiString as_GSM400_MAX_P;
- AnsiString as_GSM850_MAX_P;
- AnsiString as_GSM900_MAX_P;
- AnsiString as_DCS1800_MAX_P;
- AnsiString as_PCS1900_MAX_P;
- AnsiString as_GSM400_WANTED_P;
- AnsiString as_GSM850_WANTED_P;
- AnsiString as_GSM900_WANTED_P;
- AnsiString as_DCS1800_WANTED_P;
- AnsiString as_PCS1900_WANTED_P;
- AnsiString as_GSM400_MIN_P;
- AnsiString as_GSM850_MIN_P;
- AnsiString as_GSM900_MIN_P;
- AnsiString as_DCS1800_MIN_P;
- AnsiString as_PCS1900_MIN_P;
- AnsiString as_GSM400_C;
- AnsiString as_GSM850_C;
- AnsiString as_GSM900_C;
- AnsiString as_DCS1800_C;
- AnsiString as_PCS1900_C;
- AnsiString as_GSM400_CORRECTION;
- AnsiString as_GSM850_CORRECTION;
- AnsiString as_GSM900_CORRECTION;
- AnsiString as_DCS1800_CORRECTION;
- AnsiString as_PCS1900_CORRECTION;
- AnsiString as_APC_Check;
-
- 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 )
- {
- sbCFGTxPcl->Panels->Items[0]->Text = (AnsiString) " Load TX PCL setting from file fail";
- Application->MessageBox( "Execution Failure : Load TX PCL setting from file fail", "FAILURE", MB_OK );
- return;
- }
- if (!cfg->ReadFromIniFile(OpenDlg->FileName))
- {
- sbCFGTxPcl->Panels->Items[0]->Text = (AnsiString) " Read CFG file fail";
- Application->MessageBox( "Execution Failure : Read CFG file", "FAILURE", MB_OK );
- return;
- }
- // GSM400_CAL_PCL
- cfg->getGSM400_CAL_PCL( as_GSM400_CAL_PCL );
- String_To_Array_int(as_GSM400_CAL_PCL.c_str(), i_CAL_PCL[GSM_400_TAB_INDEX], 3);
- // GSM850_CAL_PCL
- cfg->getGSM850_CAL_PCL( as_GSM850_CAL_PCL );
- String_To_Array_int(as_GSM850_CAL_PCL.c_str(), i_CAL_PCL[GSM_850_TAB_INDEX], 3);
- // GSM900_CAL_PCL
- cfg->getGSM900_CAL_PCL( as_GSM900_CAL_PCL );
- String_To_Array_int(as_GSM900_CAL_PCL.c_str(), i_CAL_PCL[GSM_900_TAB_INDEX], 3);
- // DCS1800_CAL_PCL
- cfg->getDCS1800_CAL_PCL( as_DCS1800_CAL_PCL );
- String_To_Array_int(as_DCS1800_CAL_PCL.c_str(), i_CAL_PCL[DCS_1800_TAB_INDEX], 3);
- // PCS1900_CAL_PCL
- cfg->getPCS1900_CAL_PCL( as_PCS1900_CAL_PCL );
- String_To_Array_int(as_PCS1900_CAL_PCL.c_str(), i_CAL_PCL[PCS_1900_TAB_INDEX], 3);
- // GSM400_2CAL_PCL
- cfg->getGSM400_2CAL_PCL( as_GSM400_2CAL_PCL );
- String_To_Array_int(as_GSM400_2CAL_PCL.c_str(), i_2CAL_PCL[GSM_400_TAB_INDEX], 2);
- // GSM850_2CAL_PCL
- cfg->getGSM850_2CAL_PCL( as_GSM850_2CAL_PCL );
- String_To_Array_int(as_GSM850_2CAL_PCL.c_str(), i_2CAL_PCL[GSM_850_TAB_INDEX], 2);
- // GSM900_2CAL_PCL
- cfg->getGSM900_2CAL_PCL( as_GSM900_2CAL_PCL );
- String_To_Array_int(as_GSM900_2CAL_PCL.c_str(), i_2CAL_PCL[GSM_900_TAB_INDEX], 2);
- // DCS1800_2CAL_PCL
- cfg->getDCS1800_2CAL_PCL( as_DCS1800_2CAL_PCL );
- String_To_Array_int(as_DCS1800_2CAL_PCL.c_str(), i_2CAL_PCL[DCS_1800_TAB_INDEX], 2);
- // PCS1900_2CAL_PCL
- cfg->getPCS1900_2CAL_PCL( as_PCS1900_2CAL_PCL );
- String_To_Array_int(as_PCS1900_2CAL_PCL.c_str(), i_2CAL_PCL[PCS_1900_TAB_INDEX], 2);
- // GSM400_PCL
- cfg->getGSM400_PCL( as_GSM400_PCL );
- String_To_Array_int(as_GSM400_PCL.c_str(), i_PCL[GSM_400_TAB_INDEX], 16);
- // GSM850_PCL
- cfg->getGSM850_PCL( as_GSM850_PCL );
- String_To_Array_int(as_GSM850_PCL.c_str(), i_PCL[GSM_850_TAB_INDEX], 16);
- // GSM900_PCL
- cfg->getGSM900_PCL( as_GSM900_PCL );
- String_To_Array_int(as_GSM900_PCL.c_str(), i_PCL[GSM_900_TAB_INDEX], 16);
- // DCS1800_PCL
- cfg->getDCS1800_PCL( as_DCS1800_PCL );
- String_To_Array_int(as_DCS1800_PCL.c_str(), i_PCL[DCS_1800_TAB_INDEX], 16);
- // PCS1900_PCL
- cfg->getPCS1900_PCL( as_PCS1900_PCL );
- String_To_Array_int(as_PCS1900_PCL.c_str(), i_PCL[PCS_1900_TAB_INDEX], 16);
- // GSM400_CHECK_PCL
- cfg->getGSM400_CHECK_PCL( as_GSM400_CHECK_PCL );
- String_To_Array_int(as_GSM400_CHECK_PCL.c_str(), i_CHECK_PCL[GSM_400_TAB_INDEX], 16);
- // GSM850_CHECK_PCL
- cfg->getGSM850_CHECK_PCL( as_GSM850_CHECK_PCL );
- String_To_Array_int(as_GSM850_CHECK_PCL.c_str(), i_CHECK_PCL[GSM_850_TAB_INDEX], 16);
- // GSM900_CHECK_PCL
- cfg->getGSM900_CHECK_PCL( as_GSM900_CHECK_PCL );
- String_To_Array_int(as_GSM900_CHECK_PCL.c_str(), i_CHECK_PCL[GSM_900_TAB_INDEX], 16);
- // DCS1800_CHECK_PCL
- cfg->getDCS1800_CHECK_PCL( as_DCS1800_CHECK_PCL );
- String_To_Array_int(as_DCS1800_CHECK_PCL.c_str(), i_CHECK_PCL[DCS_1800_TAB_INDEX], 16);
- // PCS1900_CHECK_PCL
- cfg->getPCS1900_CHECK_PCL( as_PCS1900_CHECK_PCL );
- String_To_Array_int(as_PCS1900_CHECK_PCL.c_str(), i_CHECK_PCL[PCS_1900_TAB_INDEX], 16);
- // GSM400_MAX_P
- cfg->getGSM400_MAX_P( as_GSM400_MAX_P );
- String_To_Array_double(as_GSM400_MAX_P.c_str(), d_MAX_P[GSM_400_TAB_INDEX], 16);
- // GSM850_MAX_P
- cfg->getGSM850_MAX_P( as_GSM850_MAX_P );
- String_To_Array_double(as_GSM850_MAX_P.c_str(), d_MAX_P[GSM_850_TAB_INDEX], 16);
- // GSM900_MAX_P
- cfg->getGSM900_MAX_P( as_GSM900_MAX_P );
- String_To_Array_double(as_GSM900_MAX_P.c_str(), d_MAX_P[GSM_900_TAB_INDEX], 16);
- // DCS1800_MAX_P
- cfg->getDCS1800_MAX_P( as_DCS1800_MAX_P );
- String_To_Array_double(as_DCS1800_MAX_P.c_str(), d_MAX_P[DCS_1800_TAB_INDEX], 16);
- // PCS1900_MAX_P
- cfg->getPCS1900_MAX_P( as_PCS1900_MAX_P );
- String_To_Array_double(as_PCS1900_MAX_P.c_str(), d_MAX_P[PCS_1900_TAB_INDEX], 16);
- // GSM400_WANTED_P
- cfg->getGSM400_WANTED_P( as_GSM400_WANTED_P );
- String_To_Array_double(as_GSM400_WANTED_P.c_str(), d_WANTED_P[GSM_400_TAB_INDEX], 16);
- // GSM850_WANTED_P
- cfg->getGSM850_WANTED_P( as_GSM850_WANTED_P );
- String_To_Array_double(as_GSM850_WANTED_P.c_str(), d_WANTED_P[GSM_850_TAB_INDEX], 16);
- // GSM900_WANTED_P
- cfg->getGSM900_WANTED_P( as_GSM900_WANTED_P );
- String_To_Array_double(as_GSM900_WANTED_P.c_str(), d_WANTED_P[GSM_900_TAB_INDEX], 16);
- // DCS1800_WANTED_P
- cfg->getDCS1800_WANTED_P( as_DCS1800_WANTED_P );
- String_To_Array_double(as_DCS1800_WANTED_P.c_str(), d_WANTED_P[DCS_1800_TAB_INDEX], 16);
- // PCS1900_WANTED_P
- cfg->getPCS1900_WANTED_P( as_PCS1900_WANTED_P );
- String_To_Array_double(as_PCS1900_WANTED_P.c_str(), d_WANTED_P[PCS_1900_TAB_INDEX], 16);
- // GSM400_MIN_P
- cfg->getGSM400_MIN_P( as_GSM400_MIN_P );
- String_To_Array_double(as_GSM400_MIN_P.c_str(), d_MIN_P[GSM_400_TAB_INDEX], 16);
- // GSM850_MIN_P
- cfg->getGSM850_MIN_P( as_GSM850_MIN_P );
- String_To_Array_double(as_GSM850_MIN_P.c_str(), d_MIN_P[GSM_850_TAB_INDEX], 16);
- // GSM900_MIN_P
- cfg->getGSM900_MIN_P( as_GSM900_MIN_P );
- String_To_Array_double(as_GSM900_MIN_P.c_str(), d_MIN_P[GSM_900_TAB_INDEX], 16);
- // DCS1800_MIN_P
- cfg->getDCS1800_MIN_P( as_DCS1800_MIN_P );
- String_To_Array_double(as_DCS1800_MIN_P.c_str(), d_MIN_P[DCS_1800_TAB_INDEX], 16);
- // PCS1900_WANTED_P
- cfg->getPCS1900_MIN_P( as_PCS1900_MIN_P );
- String_To_Array_double(as_PCS1900_MIN_P.c_str(), d_MIN_P[PCS_1900_TAB_INDEX], 16);
- // GSM400_C
- cfg->getGSM400_C( as_GSM400_C );
- String_To_Array_double(as_GSM400_C.c_str(), d_C[GSM_400_TAB_INDEX], 16);
- // GSM850_C
- cfg->getGSM850_C( as_GSM850_C );
- String_To_Array_double(as_GSM850_C.c_str(), d_C[GSM_850_TAB_INDEX], 16);
- // GSM900_C
- cfg->getGSM900_C( as_GSM900_C );
- String_To_Array_double(as_GSM900_C.c_str(), d_C[GSM_900_TAB_INDEX], 16);
- // DCS1800_C
- cfg->getDCS1800_C( as_DCS1800_C );
- String_To_Array_double(as_DCS1800_C.c_str(), d_C[DCS_1800_TAB_INDEX], 16);
- // PCS1900_C
- cfg->getPCS1900_C( as_PCS1900_C );
- String_To_Array_double(as_PCS1900_C.c_str(), d_C[PCS_1900_TAB_INDEX], 16);
- // GSM400_CORRECTION
- cfg->getGSM400_CORRECTION( as_GSM400_CORRECTION );
- String_To_Array_double(as_GSM400_CORRECTION.c_str(), d_CORRECTION[GSM_400_TAB_INDEX], 16);
- // GSM850_CORRECTION
- cfg->getGSM850_CORRECTION( as_GSM850_CORRECTION );
- String_To_Array_double(as_GSM850_CORRECTION.c_str(), d_CORRECTION[GSM_850_TAB_INDEX], 16);
- // GSM900_CORRECTION
- cfg->getGSM900_CORRECTION( as_GSM900_CORRECTION );
- String_To_Array_double(as_GSM900_CORRECTION.c_str(), d_CORRECTION[GSM_900_TAB_INDEX], 16);
- // DCS1800_CORRECTION
- cfg->getDCS1800_CORRECTION( as_DCS1800_CORRECTION );
- String_To_Array_double(as_DCS1800_CORRECTION.c_str(), d_CORRECTION[DCS_1800_TAB_INDEX], 16);
- // PCS1900_CORRECTION
- cfg->getPCS1900_CORRECTION( as_PCS1900_CORRECTION );
- String_To_Array_double(as_PCS1900_CORRECTION.c_str(), d_CORRECTION[PCS_1900_TAB_INDEX], 16);
- // TSC
- cfg->getTSC( c_TSC );
- // Recursive Times
- cfg->getTXlevelRecursiveTimes( i_Recursive_Times );
- // APC Delta
- cfg->getAPC_Delta( d_APC_Delta );
- // APC check
- cfg->getAPC_Check( as_APC_Check );
- if( as_APC_Check.AnsiCompareIC("yes") == 0 ) m_bAPCCheck = true;
- else m_bAPCCheck = false;
-
- ReDrawFields(DRAW_CFG_CAL_PCL | DRAW_CFG_PCL | DRAW_CFG_CHECK_PCL | DRAW_CFG_MAX_P |
- DRAW_CFG_WANTED_P | DRAW_CFG_MIN_P | DRAW_CFG_C | DRAW_CFG_CORRECTION |
- DRAW_CFG_TSC | DRAW_CFG_RECURSIVE_TIMES |
- DRAW_CFG_APC_DELTA | DRAW_CFG_APC_CHECK );
- }
- //---------------------------------------------------------------------------
- void TfrmCFGTxPcl::ReDrawFields( int draw_mask )
- {
- int i, j;
- // int band = CurBand;
- char str[256];
- if( CurBand!=GSM_400_TAB_INDEX && CurBand!=GSM_850_TAB_INDEX && CurBand!=GSM_900_TAB_INDEX )
- {
- edtPCL[15]->Visible = true;
- edtCHECK_PCL[15]->Visible = true;
- edtMAX_P[15]->Visible = true;
- edtWANTED_P[15]->Visible = true;
- edtMIN_P[15]->Visible = true;
- edtC[15]->Visible = true;
- edtCORRECTION[15]->Visible = true;
- }
- else
- {
- edtPCL[15]->Visible = false;
- edtCHECK_PCL[15]->Visible = false;
- edtMAX_P[15]->Visible = false;
- edtWANTED_P[15]->Visible = false;
- edtMIN_P[15]->Visible = false;
- edtC[15]->Visible = false;
- edtCORRECTION[15]->Visible = false;
- }
- if (draw_mask & DRAW_CFG_CAL_PCL)
- {
- for(i=0; i<3; i++)
- {
- edtCAL_PCL[i]->Text = IntToStr( i_CAL_PCL[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_PCL )
- {
- for(i=0; i<16; i++)
- {
- edtPCL[i]->Text = IntToStr( i_PCL[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_CHECK_PCL )
- {
- for(i=0; i<16; i++)
- {
- edtCHECK_PCL[i]->Text = IntToStr( i_CHECK_PCL[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_MAX_P )
- {
- for(i=0; i<16; i++)
- {
- edtMAX_P[i]->Text = Double_To_AnsiString( d_MAX_P[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_WANTED_P )
- {
- for(i=0; i<16; i++)
- {
- edtWANTED_P[i]->Text = Double_To_AnsiString( d_WANTED_P[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_MIN_P )
- {
- for(i=0; i<16; i++)
- {
- edtMIN_P[i]->Text = Double_To_AnsiString( d_MIN_P[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_C )
- {
- for(i=0; i<16; i++)
- {
- edtC[i]->Text = Double_To_AnsiString( d_C[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_CORRECTION )
- {
- for(i=0; i<16; i++)
- {
- edtCORRECTION[i]->Text = Double_To_AnsiString( d_CORRECTION[CurBand][i] );
- }
- }
- if( draw_mask & DRAW_CFG_TSC )
- {
- edtTSC->Text = IntToStr(c_TSC);
- }
- if( draw_mask & DRAW_CFG_RECURSIVE_TIMES )
- {
- edtRecursiveTimes->Text = IntToStr(i_Recursive_Times);
- }
- if( draw_mask & DRAW_CFG_APC_DELTA )
- {
- edtAPCDelta->Text = Double_To_AnsiString(d_APC_Delta);
- }
- if( draw_mask & DRAW_CFG_APC_CHECK )
- {
- if( m_bAPCCheck )
- { cbAPCCheck->ItemIndex = 0;
- }
- else
- cbAPCCheck->ItemIndex = 1;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::FormShow(TObject *Sender)
- {
- if(cfg == NULL)
- {
- cfg = new TMETA_factory_cfg();
- }
-
- CurBand = tctlAPC->TabIndex;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::tctlAPCChange(TObject *Sender)
- {
- if( !CheckFields() )
- {
- tctlAPC->TabIndex = CurBand;
- return;
- }
- CurBand = tctlAPC->TabIndex;
- // lastTabIndex = tctlAPC->TabIndex;
- // CurPCLIndex = 0;
- ReDrawFields(DRAW_CFG_CAL_PCL | DRAW_CFG_PCL | DRAW_CFG_CHECK_PCL | DRAW_CFG_MAX_P |
- DRAW_CFG_WANTED_P | DRAW_CFG_MIN_P | DRAW_CFG_C | DRAW_CFG_CORRECTION | DRAW_CFG_TSC |
- DRAW_CFG_RECURSIVE_TIMES | DRAW_CFG_APC_DELTA | DRAW_CFG_APC_CHECK );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGTxPcl::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() )
- {
- sbCFGTxPcl->Panels->Items[0]->Text = (AnsiString) " Save TX PCL setting to file fail";
- Application->MessageBox( "Execution Failure : Save TX PCL setting to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDlg->Execute();
- if( !ok )
- {
- sbCFGTxPcl->Panels->Items[0]->Text = (AnsiString) " Save TX PCL setting to file fail";
- Application->MessageBox( "Execution Failure : Save TX PCL setting to file", "FAILURE", MB_OK );
- return;
- }
- cfg->SaveTxPclToCfgFile( SaveDlg->FileName );
- }
- //---------------------------------------------------------------------------