form_CFGRxPathLoss.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:29k
- /*****************************************************************************
- * 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_CFGRxPahtLoss.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RX path loss 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>
- #include <assert.h>
- #pragma hdrstop
- // form
- #include "form_CFGRxPathLoss.h"
- #include "META_Factory.h"
- #include "meta_const.h"
- // misc
- #include "misc.h"
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmCFGRxPathLoss *frmCFGRxPathLoss;
- //---------------------------------------------------------------------------
- __fastcall TfrmCFGRxPathLoss::TfrmCFGRxPathLoss(TComponent* Owner)
- : TForm(Owner)
- {
- // RX path loss
- InitRxPathLoss();
- }
- //---------------------------------------------------------------------------
- void TfrmCFGRxPathLoss::InitRxPathLoss( void )
- {
- edtMAX_RX_LOSS[FrequencyBand850][ 0] = edtGSM850_MAX_RX_LOSS_0;
- edtMAX_RX_LOSS[FrequencyBand850][ 1] = edtGSM850_MAX_RX_LOSS_1;
- edtMAX_RX_LOSS[FrequencyBand850][ 2] = edtGSM850_MAX_RX_LOSS_2;
- edtMAX_RX_LOSS[FrequencyBand850][ 3] = edtGSM850_MAX_RX_LOSS_3;
- edtMAX_RX_LOSS[FrequencyBand850][ 4] = edtGSM850_MAX_RX_LOSS_4;
- edtMAX_RX_LOSS[FrequencyBand850][ 5] = edtGSM850_MAX_RX_LOSS_5;
- edtMAX_RX_LOSS[FrequencyBand850][ 6] = edtGSM850_MAX_RX_LOSS_6;
- edtMAX_RX_LOSS[FrequencyBand850][ 7] = edtGSM850_MAX_RX_LOSS_7;
- edtMAX_RX_LOSS[FrequencyBand850][ 8] = edtGSM850_MAX_RX_LOSS_8;
- edtMAX_RX_LOSS[FrequencyBand850][ 9] = edtGSM850_MAX_RX_LOSS_9;
- edtMAX_RX_LOSS[FrequencyBand850][10] = edtGSM850_MAX_RX_LOSS_10;
- edtMAX_RX_LOSS[FrequencyBand850][11] = edtGSM850_MAX_RX_LOSS_11;
- edtMIN_RX_LOSS[FrequencyBand850][ 0] = edtGSM850_MIN_RX_LOSS_0;
- edtMIN_RX_LOSS[FrequencyBand850][ 1] = edtGSM850_MIN_RX_LOSS_1;
- edtMIN_RX_LOSS[FrequencyBand850][ 2] = edtGSM850_MIN_RX_LOSS_2;
- edtMIN_RX_LOSS[FrequencyBand850][ 3] = edtGSM850_MIN_RX_LOSS_3;
- edtMIN_RX_LOSS[FrequencyBand850][ 4] = edtGSM850_MIN_RX_LOSS_4;
- edtMIN_RX_LOSS[FrequencyBand850][ 5] = edtGSM850_MIN_RX_LOSS_5;
- edtMIN_RX_LOSS[FrequencyBand850][ 6] = edtGSM850_MIN_RX_LOSS_6;
- edtMIN_RX_LOSS[FrequencyBand850][ 7] = edtGSM850_MIN_RX_LOSS_7;
- edtMIN_RX_LOSS[FrequencyBand850][ 8] = edtGSM850_MIN_RX_LOSS_8;
- edtMIN_RX_LOSS[FrequencyBand850][ 9] = edtGSM850_MIN_RX_LOSS_9;
- edtMIN_RX_LOSS[FrequencyBand850][10] = edtGSM850_MIN_RX_LOSS_10;
- edtMIN_RX_LOSS[FrequencyBand850][11] = edtGSM850_MIN_RX_LOSS_11;
- edtMAX_RX_LOSS[FrequencyBand900][ 0] = edtGSM900_MAX_RX_LOSS_0;
- edtMAX_RX_LOSS[FrequencyBand900][ 1] = edtGSM900_MAX_RX_LOSS_1;
- edtMAX_RX_LOSS[FrequencyBand900][ 2] = edtGSM900_MAX_RX_LOSS_2;
- edtMAX_RX_LOSS[FrequencyBand900][ 3] = edtGSM900_MAX_RX_LOSS_3;
- edtMAX_RX_LOSS[FrequencyBand900][ 4] = edtGSM900_MAX_RX_LOSS_4;
- edtMAX_RX_LOSS[FrequencyBand900][ 5] = edtGSM900_MAX_RX_LOSS_5;
- edtMAX_RX_LOSS[FrequencyBand900][ 6] = edtGSM900_MAX_RX_LOSS_6;
- edtMAX_RX_LOSS[FrequencyBand900][ 7] = edtGSM900_MAX_RX_LOSS_7;
- edtMAX_RX_LOSS[FrequencyBand900][ 8] = edtGSM900_MAX_RX_LOSS_8;
- edtMAX_RX_LOSS[FrequencyBand900][ 9] = edtGSM900_MAX_RX_LOSS_9;
- edtMAX_RX_LOSS[FrequencyBand900][10] = edtGSM900_MAX_RX_LOSS_10;
- edtMAX_RX_LOSS[FrequencyBand900][11] = edtGSM900_MAX_RX_LOSS_11;
- edtMIN_RX_LOSS[FrequencyBand900][ 0] = edtGSM900_MIN_RX_LOSS_0;
- edtMIN_RX_LOSS[FrequencyBand900][ 1] = edtGSM900_MIN_RX_LOSS_1;
- edtMIN_RX_LOSS[FrequencyBand900][ 2] = edtGSM900_MIN_RX_LOSS_2;
- edtMIN_RX_LOSS[FrequencyBand900][ 3] = edtGSM900_MIN_RX_LOSS_3;
- edtMIN_RX_LOSS[FrequencyBand900][ 4] = edtGSM900_MIN_RX_LOSS_4;
- edtMIN_RX_LOSS[FrequencyBand900][ 5] = edtGSM900_MIN_RX_LOSS_5;
- edtMIN_RX_LOSS[FrequencyBand900][ 6] = edtGSM900_MIN_RX_LOSS_6;
- edtMIN_RX_LOSS[FrequencyBand900][ 7] = edtGSM900_MIN_RX_LOSS_7;
- edtMIN_RX_LOSS[FrequencyBand900][ 8] = edtGSM900_MIN_RX_LOSS_8;
- edtMIN_RX_LOSS[FrequencyBand900][ 9] = edtGSM900_MIN_RX_LOSS_9;
- edtMIN_RX_LOSS[FrequencyBand900][10] = edtGSM900_MIN_RX_LOSS_10;
- edtMIN_RX_LOSS[FrequencyBand900][11] = edtGSM900_MIN_RX_LOSS_11;
- edtMAX_RX_LOSS[FrequencyBand1800][ 0] = edtDCS1800_MAX_RX_LOSS_0;
- edtMAX_RX_LOSS[FrequencyBand1800][ 1] = edtDCS1800_MAX_RX_LOSS_1;
- edtMAX_RX_LOSS[FrequencyBand1800][ 2] = edtDCS1800_MAX_RX_LOSS_2;
- edtMAX_RX_LOSS[FrequencyBand1800][ 3] = edtDCS1800_MAX_RX_LOSS_3;
- edtMAX_RX_LOSS[FrequencyBand1800][ 4] = edtDCS1800_MAX_RX_LOSS_4;
- edtMAX_RX_LOSS[FrequencyBand1800][ 5] = edtDCS1800_MAX_RX_LOSS_5;
- edtMAX_RX_LOSS[FrequencyBand1800][ 6] = edtDCS1800_MAX_RX_LOSS_6;
- edtMAX_RX_LOSS[FrequencyBand1800][ 7] = edtDCS1800_MAX_RX_LOSS_7;
- edtMAX_RX_LOSS[FrequencyBand1800][ 8] = edtDCS1800_MAX_RX_LOSS_8;
- edtMAX_RX_LOSS[FrequencyBand1800][ 9] = edtDCS1800_MAX_RX_LOSS_9;
- edtMAX_RX_LOSS[FrequencyBand1800][10] = edtDCS1800_MAX_RX_LOSS_10;
- edtMAX_RX_LOSS[FrequencyBand1800][11] = edtDCS1800_MAX_RX_LOSS_11;
- edtMIN_RX_LOSS[FrequencyBand1800][ 0] = edtDCS1800_MIN_RX_LOSS_0;
- edtMIN_RX_LOSS[FrequencyBand1800][ 1] = edtDCS1800_MIN_RX_LOSS_1;
- edtMIN_RX_LOSS[FrequencyBand1800][ 2] = edtDCS1800_MIN_RX_LOSS_2;
- edtMIN_RX_LOSS[FrequencyBand1800][ 3] = edtDCS1800_MIN_RX_LOSS_3;
- edtMIN_RX_LOSS[FrequencyBand1800][ 4] = edtDCS1800_MIN_RX_LOSS_4;
- edtMIN_RX_LOSS[FrequencyBand1800][ 5] = edtDCS1800_MIN_RX_LOSS_5;
- edtMIN_RX_LOSS[FrequencyBand1800][ 6] = edtDCS1800_MIN_RX_LOSS_6;
- edtMIN_RX_LOSS[FrequencyBand1800][ 7] = edtDCS1800_MIN_RX_LOSS_7;
- edtMIN_RX_LOSS[FrequencyBand1800][ 8] = edtDCS1800_MIN_RX_LOSS_8;
- edtMIN_RX_LOSS[FrequencyBand1800][ 9] = edtDCS1800_MIN_RX_LOSS_9;
- edtMIN_RX_LOSS[FrequencyBand1800][10] = edtDCS1800_MIN_RX_LOSS_10;
- edtMIN_RX_LOSS[FrequencyBand1800][11] = edtDCS1800_MIN_RX_LOSS_11;
- edtMAX_RX_LOSS[FrequencyBand1900][ 0] = edtPCS1900_MAX_RX_LOSS_0;
- edtMAX_RX_LOSS[FrequencyBand1900][ 1] = edtPCS1900_MAX_RX_LOSS_1;
- edtMAX_RX_LOSS[FrequencyBand1900][ 2] = edtPCS1900_MAX_RX_LOSS_2;
- edtMAX_RX_LOSS[FrequencyBand1900][ 3] = edtPCS1900_MAX_RX_LOSS_3;
- edtMAX_RX_LOSS[FrequencyBand1900][ 4] = edtPCS1900_MAX_RX_LOSS_4;
- edtMAX_RX_LOSS[FrequencyBand1900][ 5] = edtPCS1900_MAX_RX_LOSS_5;
- edtMAX_RX_LOSS[FrequencyBand1900][ 6] = edtPCS1900_MAX_RX_LOSS_6;
- edtMAX_RX_LOSS[FrequencyBand1900][ 7] = edtPCS1900_MAX_RX_LOSS_7;
- edtMAX_RX_LOSS[FrequencyBand1900][ 8] = edtPCS1900_MAX_RX_LOSS_8;
- edtMAX_RX_LOSS[FrequencyBand1900][ 9] = edtPCS1900_MAX_RX_LOSS_9;
- edtMAX_RX_LOSS[FrequencyBand1900][10] = edtPCS1900_MAX_RX_LOSS_10;
- edtMAX_RX_LOSS[FrequencyBand1900][11] = edtPCS1900_MAX_RX_LOSS_11;
- edtMIN_RX_LOSS[FrequencyBand1900][ 0] = edtPCS1900_MIN_RX_LOSS_0;
- edtMIN_RX_LOSS[FrequencyBand1900][ 1] = edtPCS1900_MIN_RX_LOSS_1;
- edtMIN_RX_LOSS[FrequencyBand1900][ 2] = edtPCS1900_MIN_RX_LOSS_2;
- edtMIN_RX_LOSS[FrequencyBand1900][ 3] = edtPCS1900_MIN_RX_LOSS_3;
- edtMIN_RX_LOSS[FrequencyBand1900][ 4] = edtPCS1900_MIN_RX_LOSS_4;
- edtMIN_RX_LOSS[FrequencyBand1900][ 5] = edtPCS1900_MIN_RX_LOSS_5;
- edtMIN_RX_LOSS[FrequencyBand1900][ 6] = edtPCS1900_MIN_RX_LOSS_6;
- edtMIN_RX_LOSS[FrequencyBand1900][ 7] = edtPCS1900_MIN_RX_LOSS_7;
- edtMIN_RX_LOSS[FrequencyBand1900][ 8] = edtPCS1900_MIN_RX_LOSS_8;
- edtMIN_RX_LOSS[FrequencyBand1900][ 9] = edtPCS1900_MIN_RX_LOSS_9;
- edtMIN_RX_LOSS[FrequencyBand1900][10] = edtPCS1900_MIN_RX_LOSS_10;
- edtMIN_RX_LOSS[FrequencyBand1900][11] = edtPCS1900_MIN_RX_LOSS_11;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::btnLoadFromCFGFileClick(TObject *Sender)
- {
- bool ok;
- AnsiString asPath, asFileName;
- AnsiString as_sub_max_rx_loss, as_sub_min_rx_loss;
- int i;
- 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 )
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Load RX path loss setting from file fail";
- Application->MessageBox( "Execution Failure : Load RX path loss setting from file fail", "FAILURE", MB_OK );
- return;
- }
- if (!cfg->ReadFromIniFile(OpenDlg->FileName))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Read CFG file fail";
- Application->MessageBox( "Execution Failure : Read CFG file", "FAILURE", MB_OK );
- return;
- }
- // N_PM
- cfg->getN_PM( iN_PM );
- edtN_PM->Text = IntToStr( iN_PM );
- // M_PM
- cfg->getM_PM( cM_PM );
- cbM_PM->ItemIndex = IntToStr( cM_PM ) - 1;
- // GSM850_MAX_RX_LOSS
- cfg->getGSM850_MAX_RX_LOSS( as_MAX_RX_LOSS[FrequencyBand850] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MAX_RX_LOSS[FrequencyBand850], i, DEFAULT_SEP_CHAR, as_sub_max_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get GSM850_MAX_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get GSM850_MAX_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMAX_RX_LOSS[FrequencyBand850][i-1]->Text = as_sub_max_rx_loss;
- }
- // GSM850_MIN_RX_LOSS
- cfg->getGSM850_MIN_RX_LOSS( as_MIN_RX_LOSS[FrequencyBand850] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MIN_RX_LOSS[FrequencyBand850], i, DEFAULT_SEP_CHAR, as_sub_min_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get GSM850_MIN_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get GSM850_MIN_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMIN_RX_LOSS[FrequencyBand850][i-1]->Text = as_sub_min_rx_loss;
- }
- // GSM900_MAX_RX_LOSS
- cfg->getGSM900_MAX_RX_LOSS( as_MAX_RX_LOSS[FrequencyBand900] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MAX_RX_LOSS[FrequencyBand900], i, DEFAULT_SEP_CHAR, as_sub_max_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get GSM900_MAX_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get GSM900_MAX_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMAX_RX_LOSS[FrequencyBand900][i-1]->Text = as_sub_max_rx_loss;
- }
- // GSM900_MIN_RX_LOSS
- cfg->getGSM900_MIN_RX_LOSS( as_MIN_RX_LOSS[FrequencyBand900] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MIN_RX_LOSS[FrequencyBand900], i, DEFAULT_SEP_CHAR, as_sub_min_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get GSM900_MIN_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get GSM900_MIN_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMIN_RX_LOSS[FrequencyBand900][i-1]->Text = as_sub_min_rx_loss;
- }
- // DCS1800_MAX_RX_LOSS
- cfg->getDCS1800_MAX_RX_LOSS( as_MAX_RX_LOSS[FrequencyBand1800] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MAX_RX_LOSS[FrequencyBand1800], i, DEFAULT_SEP_CHAR, as_sub_max_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get DCS1800_MAX_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get DCS1800_MAX_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMAX_RX_LOSS[FrequencyBand1800][i-1]->Text = as_sub_max_rx_loss;
- }
- // DCS1800_MIN_RX_LOSS
- cfg->getDCS1800_MIN_RX_LOSS( as_MIN_RX_LOSS[FrequencyBand1800] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MIN_RX_LOSS[FrequencyBand1800], i, DEFAULT_SEP_CHAR, as_sub_min_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get DCS1800_MIN_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get DCS1800_MIN_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMIN_RX_LOSS[FrequencyBand1800][i-1]->Text = as_sub_min_rx_loss;
- }
- // PCS1900_MAX_RX_LOSS
- cfg->getPCS1900_MAX_RX_LOSS( as_MAX_RX_LOSS[FrequencyBand1900] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MAX_RX_LOSS[FrequencyBand1900], i, DEFAULT_SEP_CHAR, as_sub_max_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get PCS1900_MAX_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get PCS1900_MAX_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMAX_RX_LOSS[FrequencyBand1900][i-1]->Text = as_sub_max_rx_loss;
- }
- // PCS1900_MIN_RX_LOSS
- cfg->getPCS1900_MIN_RX_LOSS( as_MIN_RX_LOSS[FrequencyBand1900] );
- for( i=1; i<PLTABLE_SIZE; i++)
- {
- if(! getAnsiStrSubItem( as_MIN_RX_LOSS[FrequencyBand1900], i, DEFAULT_SEP_CHAR, as_sub_min_rx_loss ))
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Get PCS1900_MIN_RX_LOSS from file fail";
- Application->MessageBox( "Execution Failure : Get PCS1900_MIN_RX_LOSS from file fail", "FAILURE", MB_OK );
- return;
- }
- edtMIN_RX_LOSS[FrequencyBand1900][i-1]->Text = as_sub_min_rx_loss;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::FormDestroy(TObject *Sender)
- {
- if(cfg != NULL)
- {
- delete cfg;
- cfg = NULL;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::btnSaveToCFGFileClick(TObject *Sender)
- {
- bool ok;
- int i;
- AnsiString asPath, asFileName;
- static bool isFirstSave = true;
- if( ! CheckFields() )
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Save RX path loss setting to file fail";
- Application->MessageBox( "Execution Failure : Save RX path loss setting to file", "FAILURE", MB_OK );
- return;
- }
-
- 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:\";
- }
- }
- }
- ok = SaveDlg->Execute();
- if( !ok )
- {
- sbCFGRxPathLoss->Panels->Items[0]->Text = (AnsiString) " Save RX path loss setting to file fail";
- Application->MessageBox( "Execution Failure : Save RX path loss setting to file", "FAILURE", MB_OK );
- return;
- }
- cfg->SaveRxPathLossToCfgFile( SaveDlg->FileName );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if(cfg != NULL)
- {
- delete cfg;
- cfg = NULL;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::FormShow(TObject *Sender)
- {
- static bool isFirstFormShow = true;
- if(cfg == NULL)
- {
- cfg = new TMETA_factory_cfg();
- }
-
- if( isFirstFormShow )
- {
- isFirstFormShow = false;
- CheckFields();
- }
- }
- //---------------------------------------------------------------------------
- bool TfrmCFGRxPathLoss::CheckFields( void )
- {
- int i, j;
- float fdata[FrequencyBandCount][PLTABLE_SIZE];
- char str[2048];
- AnsiString text;
- cM_PM = cbM_PM->ItemIndex + 1;
- cfg->setM_PM( cM_PM );
- text = edtN_PM->Text; if( !IsValidCFGPMCount( text, cM_PM, iN_PM ) ) { edtN_PMCheck(edtN_PM); return(false); }
- cfg->setN_PM( iN_PM );
- for(i=0; i<FrequencyBandCount; i++)
- {
- for(j=0; j<PLTABLE_SIZE-1; j++)
- {
- text = edtMAX_RX_LOSS[i][j]->Text; if( !IsValidPathLoss( text, f_MAX_RX_LOSS[i][j] ) ) { edtMaxPathLossCheck(i, edtMAX_RX_LOSS[i][j]); return(false); }
- text = edtMIN_RX_LOSS[i][j]->Text; if( !IsValidPathLoss( text, f_MIN_RX_LOSS[i][j] ) ) { edtMinPathLossCheck(i, edtMIN_RX_LOSS[i][j]); return(false); }
- }
- Array_To_String_float( str, f_MAX_RX_LOSS[i], PLTABLE_SIZE-1, ',' );
- strcat( str, "," );
- cfg->setMAX_RX_LOSS( i, str );
- Array_To_String_float( str, f_MIN_RX_LOSS[i], PLTABLE_SIZE-1, ',' );
- strcat( str, "," );
- cfg->setMIN_RX_LOSS( i, str );
- }
- return true;
- }
- //---------------------------------------------------------------------------
- void TfrmCFGRxPathLoss::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 TfrmCFGRxPathLoss::edtGSM400_MAX_RX_LOSS_Check(TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MAX_RX_LOSS[FrequencyBand400][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtGSM400_MIN_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MIN_RX_LOSS[FrequencyBand400][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtGSM850_MAX_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MAX_RX_LOSS[FrequencyBand850][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtGSM850_MIN_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MIN_RX_LOSS[FrequencyBand850][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtGSM900_MAX_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MAX_RX_LOSS[FrequencyBand900][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtGSM900_MIN_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MIN_RX_LOSS[FrequencyBand900][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtDCS1800_MAX_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MAX_RX_LOSS[FrequencyBand1800][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtDCS1800_MIN_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MIN_RX_LOSS[FrequencyBand1800][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtPCS1900_MAX_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MAX_RX_LOSS[FrequencyBand1900][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtPCS1900_MIN_RX_LOSS_Check(
- TObject *Sender)
- {
- AnsiString text;
- float fdata;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidPathLoss( text, fdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- f_MIN_RX_LOSS[FrequencyBand1900][Tag] = fdata;
- }
- //---------------------------------------------------------------------------
- void TfrmCFGRxPathLoss::edtMaxPathLossCheck(int idx, TObject *Sender)
- {
- switch( idx )
- {
- case FrequencyBand400:
- edtGSM400_MAX_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand850:
- edtGSM850_MAX_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand900:
- edtGSM900_MAX_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand1800:
- edtDCS1800_MAX_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand1900:
- edtPCS1900_MAX_RX_LOSS_Check( Sender );
- break;
- default:
- assert( false );
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmCFGRxPathLoss::edtMinPathLossCheck(int idx, TObject *Sender)
- {
- switch( idx )
- {
- case FrequencyBand400:
- edtGSM400_MIN_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand850:
- edtGSM850_MIN_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand900:
- edtGSM900_MIN_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand1800:
- edtDCS1800_MIN_RX_LOSS_Check( Sender );
- break;
- case FrequencyBand1900:
- edtPCS1900_MIN_RX_LOSS_Check( Sender );
- break;
- default:
- assert( false );
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::edtN_PMCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 0~2000 ",
- " value shall be 0~1000 ",
- " value shall be 0~666 ",
- " value shall be 0~500 "
- };
- char m_pm = cbM_PM->ItemIndex + 1;
- text = edit->Text;
- if (!IsValidCFGPMCount(text, m_pm, sdata))
- {
- ShowHintLabel(edit, hint[m_pm-1]);
- edit->SetFocus();
- return;
- }
- iN_PM = sdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmCFGRxPathLoss::cbM_PMChange(TObject *Sender)
- {
- edtN_PMCheck( edtN_PM );
- }
- //---------------------------------------------------------------------------