form_RFGUIApcProfile.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:66k
源码类别:
MTK
开发平台:
C++ Builder
- /*****************************************************************************
- * 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_RFGUIApcProfile.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RF graphic interface APC profile form source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision: 1.2 $
- * $Modtime: Sep 11 2004 14:13:48 $
- * $Log: //mtkvs01/vmdata/meta_app/archives/MauiMETA/Form/form_RFGUIApcProfile.cpp-arc $
- *
- * Rev 1.2 Sep 11 2004 15:15:28 mtk00490
- * Maui META ver 3.5.05
- *
- * Rev 1.1 Jun 24 2004 11:49:40 mtk00490
- * Maui META ver 3.5.04
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "man_fdm.h"
- // form
- #include "form_main.h"
- #include "form_RFGUIApcProfile.h"
- #include "form_RFApcProfile.h"
- // message
- #ifndef _META_LAB_MSG_H_
- #include "meta_lab_msg.h"
- #endif
- // thread
- #ifndef _RF_TADO_THRD_H_
- #include "rf_tado_thrd.h"
- #endif
- #ifndef _RF_SETRAMP_THRD_H_
- #include "rf_setramp_thrd.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmGUIApcProfile *frmGUIApcProfile;
- HANDLE p_TxStop_Event;
- // query
- extern T_RFTADO* pt_rftado;
- extern T_RFSETRAMP* pt_rfsetramp;
- //==============================================================================
- static void CNF_NVRAM_Init(void)
- {
- frmGUIApcProfile->CNF_NVRAM_Init();
- }
- //---------------------------------------------------------------------------
- static void CNF_ReadFromNVRAM(void)
- {
- frmGUIApcProfile->CNF_ReadFromNVRAM();
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteToNVRAM(void)
- {
- frmGUIApcProfile->DownloadToFlashDone();
- }
- //---------------------------------------------------------------------------
- static void ConfirmCallback_RfSetRampTable( void )
- {
- frmGUIApcProfile->ConfirmCallback_RfSetRampTable();
- }
- //---------------------------------------------------------------------------
- static void ConfirmCallback_TX(void)
- {
- frmGUIApcProfile->ConfirmCallback_TX();
- }
- //===========================================================================
- void TfrmGUIApcProfile::Init( void )
- {
- m_bInit = true;
- m_bTADOSupport = false;
- CurrentPageReset();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::FormCreate(TObject *Sender)
- {
- m_uiFinalRFID = 0;
- WindowProc = SubClassWndProc;
- Init();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- imRampProfile->Enabled = true;
- m_bMultiSlotTxExSupport = frmRFTool->Get_MultiSlotTxExSupport();
- }
- AnsiString text;
- Tsc = frmRFTool->cbxTXTsc->ItemIndex;
- text = frmRFTool->edtTXAfc->Text; if( !IsValidAFC( text, m_sAfcDac ) ) { m_sAfcDac = 4100; }
- m_eBurstType = frmRFTool->Get_GmskBurstType();
- }
- //===========================================================================
- void TfrmGUIApcProfile::ConfirmCallback_TX(void)
- {
- E_METAAPP_RESULT_T state = RF_TX_Obj->Get_ConfirmState();
- if (m_bDragTrigger)
- {
- imRampProfile->Enabled = true;
- m_bDragTrigger = false;
- }
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX fail";
- Application->MessageBox("Execution failure : Burst TX", "FAILURE", MB_OK);
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX timeout";
- Application->MessageBox("Execution Timeout : Burst TX", "TIMEOUT", MB_OK);
- }
- break;
- case METAAPP_STOP:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- break;
- }
- }
- //==============================================================================
- __fastcall TfrmGUIApcProfile::TfrmGUIApcProfile(TComponent* Owner)
- : TForm(Owner)
- {
- // initialization
- isRampUpCircleOnDrag = false;
- isRampDownCircleOnDrag = false;
- m_bDragTrigger = false;
- Tsc = 5;
- m_sAfcDac = 4100;
- m_eBurstType = NB_TX_RANDOM_WITH_TSC; // NB
- m_eCurBand = (E_BANDSEL) BANDSEL_GSM900;
- m_sCurPCLIndex = 0;
- for(int band=0; band<MAX_SUPPORT_BAND_NUM; band++)
- {
- m_usHighApcDcOffset[band] = 0;
- m_usLowApcDcOffset[band] = 0;
- }
- m_sTestArfcn[BANDSEL_GSM900 ] = 0;
- m_sTestArfcn[BANDSEL_DCS1800] = 512;
- m_sTestArfcn[BANDSEL_PCS1900] = 512;
- m_sTestArfcn[BANDSEL_GSM850] = 128;
- lastTabIndex = 0; // GSM 900
- edtPCLDAC[ 0]=edtPCLDAC00; btnPCL[ 0]=btnPCL00; edtRampUp[ 0]=edtRampUp00; edtRampDn[ 0]=edtRampDn00;
- edtPCLDAC[ 1]=edtPCLDAC01; btnPCL[ 1]=btnPCL01; edtRampUp[ 1]=edtRampUp01; edtRampDn[ 1]=edtRampDn01;
- edtPCLDAC[ 2]=edtPCLDAC02; btnPCL[ 2]=btnPCL02; edtRampUp[ 2]=edtRampUp02; edtRampDn[ 2]=edtRampDn02;
- edtPCLDAC[ 3]=edtPCLDAC03; btnPCL[ 3]=btnPCL03; edtRampUp[ 3]=edtRampUp03; edtRampDn[ 3]=edtRampDn03;
- edtPCLDAC[ 4]=edtPCLDAC04; btnPCL[ 4]=btnPCL04; edtRampUp[ 4]=edtRampUp04; edtRampDn[ 4]=edtRampDn04;
- edtPCLDAC[ 5]=edtPCLDAC05; btnPCL[ 5]=btnPCL05; edtRampUp[ 5]=edtRampUp05; edtRampDn[ 5]=edtRampDn05;
- edtPCLDAC[ 6]=edtPCLDAC06; btnPCL[ 6]=btnPCL06; edtRampUp[ 6]=edtRampUp06; edtRampDn[ 6]=edtRampDn06;
- edtPCLDAC[ 7]=edtPCLDAC07; btnPCL[ 7]=btnPCL07; edtRampUp[ 7]=edtRampUp07; edtRampDn[ 7]=edtRampDn07;
- edtPCLDAC[ 8]=edtPCLDAC08; btnPCL[ 8]=btnPCL08; edtRampUp[ 8]=edtRampUp08; edtRampDn[ 8]=edtRampDn08;
- edtPCLDAC[ 9]=edtPCLDAC09; btnPCL[ 9]=btnPCL09; edtRampUp[ 9]=edtRampUp09; edtRampDn[ 9]=edtRampDn09;
- edtPCLDAC[10]=edtPCLDAC10; btnPCL[10]=btnPCL10; edtRampUp[10]=edtRampUp10; edtRampDn[10]=edtRampDn10;
- edtPCLDAC[11]=edtPCLDAC11; btnPCL[11]=btnPCL11; edtRampUp[11]=edtRampUp11; edtRampDn[11]=edtRampDn11;
- edtPCLDAC[12]=edtPCLDAC12; btnPCL[12]=btnPCL12; edtRampUp[12]=edtRampUp12; edtRampDn[12]=edtRampDn12;
- edtPCLDAC[13]=edtPCLDAC13; btnPCL[13]=btnPCL13; edtRampUp[13]=edtRampUp13; edtRampDn[13]=edtRampDn13;
- edtPCLDAC[14]=edtPCLDAC14; btnPCL[14]=btnPCL14; edtRampUp[14]=edtRampUp14; edtRampDn[14]=edtRampDn14;
- edtPCLDAC[15]=edtPCLDAC15; btnPCL[15]=btnPCL15; edtRampUp[15]=edtRampUp15; edtRampDn[15]=edtRampDn15;
- lblVertical[0] = lblVertical0;
- lblVertical[1] = lblVertical1;
- lblVertical[2] = lblVertical2;
- lblVertical[3] = lblVertical3;
- lblVertical[4] = lblVertical4;
- lblVertical[5] = lblVertical5;
- lblVertical[6] = lblVertical6;
- lblVertical[7] = lblVertical7;
- lblVertical[8] = lblVertical8;
- lblVertical[9] = lblVertical9;
- lblRampUpH[0] = lblRampUpH0; lblRampDownH[0] = lblRampDownH0;
- lblRampUpH[1] = lblRampUpH1; lblRampDownH[1] = lblRampDownH1;
- lblRampUpH[2] = lblRampUpH2; lblRampDownH[2] = lblRampDownH2;
- lblRampUpH[3] = lblRampUpH3; lblRampDownH[3] = lblRampDownH3;
- lblRampUpH[4] = lblRampUpH4; lblRampDownH[4] = lblRampDownH4;
- lblRampUpH[5] = lblRampUpH5; lblRampDownH[5] = lblRampDownH5;
- lblRampUpH[6] = lblRampUpH6; lblRampDownH[6] = lblRampDownH6;
- lblRampUpH[7] = lblRampUpH7; lblRampDownH[7] = lblRampDownH7;
- lblRampUpH[8] = lblRampUpH8; lblRampDownH[8] = lblRampDownH8;
- lblRampUpH[9] = lblRampUpH9; lblRampDownH[9] = lblRampDownH9;
- lblRampUpH[10] = lblRampUpH10; lblRampDownH[10] = lblRampDownH10;
- lblRampUpH[11] = lblRampUpH11; lblRampDownH[11] = lblRampDownH11;
- lblRampUpH[12] = lblRampUpH12; lblRampDownH[12] = lblRampDownH12;
- lblRampUpH[13] = lblRampUpH13; lblRampDownH[13] = lblRampDownH13;
- lblRampUpH[14] = lblRampUpH14; lblRampDownH[14] = lblRampDownH14;
- lblRampUpH[15] = lblRampUpH15; lblRampDownH[15] = lblRampDownH15;
- vStart = 30;
- //ReDrawFields(DRAW_PCL|DRAW_RAMP);
- // PlotCurve( PLOT_RAMP_GRID );
- }
- //---------------------------------------------------------------------------
- void _fastcall TfrmGUIApcProfile::SubClassWndProc( Messages::TMessage &Message)
- {
- switch ( Message.Msg )
- {
- case WM_MF_QUERY_RFTWOAPCDOOFFSET_SUCCESS:
- {
- m_bTADOSupport = true;
- lblLowApcDcOffset->Visible = true;
- edtLowApcDcOffset->Visible = true;
- lblAPCLowestPower->Visible = true;
- edtAPCLowestPower->Visible = true;
- Query_RfSetRampTable_Support();
- }
- break;
- case WM_MF_QUERY_RFTWOAPCDOOFFSET_FAILED:
- {
- m_bTADOSupport = false;
- lblLowApcDcOffset->Visible = false;
- edtLowApcDcOffset->Visible = false;
- lblAPCLowestPower->Visible = false;
- edtAPCLowestPower->Visible = false;
- Query_RfSetRampTable_Support();
- }
- break;
- case WM_ML_NVRAM_READ_GMSK_APC_CNF:
- {
- UploadFromFlashDone();
- }
- break;
- // case WM_ML_QUERY_RFSETRAMPTABLE_SUCCESS:
- // read_APC_files_setup( "MF_setup.txt", Application->ExeName );
- // btnUploadFromFlashClick(this);
- // break;
- // case WM_ML_QUERY_RFSETRAMPTABLE_FAILED:
- // read_APC_files_setup( "MF_setup.txt", Application->ExeName );
- // btnUploadFromFlashClick(this);
- // break;
- default:
- this->WndProc( Message );
- break;
- }
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::FormShow(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- Query_RfSetRampTable_Support();
- m_bTADOSupport = frmMainSel->Get_TADO_Support();
- DisplayTADOUI( m_bTADOSupport );
- }
- m_bDragTrigger = false;
- ReDrawFields(DRAW_GUI_PCL|DRAW_GUI_RAMP);
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::read_APC_files_setup( AnsiString asSetupFile, AnsiString asExeName )
- {
- AnsiString as_NVRAM_DB_File;
- AnsiString asPath;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- TIniFile *ini;
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini != NULL)
- {
- //stNVRAMDB->Caption = ini->ReadString("RF tool","NVRAM database file", "");
- // if ( stNVRAMDB->Caption.Length() >0)
- // {
- // read_APC_db_file( stNVRAMDB->Caption );
- // }
- as_NVRAM_DB_File = ini->ReadString("RF tool","NVRAM database file", "");
- read_db_file(as_NVRAM_DB_File);
- // {
- // UpdateDBFileCaption(as_NVRAM_DB_File);
- // frmRFTool->UpdateDBFileCaption(as_NVRAM_DB_File);
- // }
- delete ini;
- ini = NULL;
- }
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " RF tool : read setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::UpdateDBFileCaption( AnsiString asFileName )
- {
- m_stNVRAMDB->Caption = asFileName;
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::read_db_file(AnsiString asFileName)
- {
- #if 0
- unsigned long nvram_idb;
- if(! NVRAMMan->Get_IsInit() || asFileName.AnsiCompareIC(NVRAMMan->Get_NVRAM_DB_File()) )
- {
- frmMainSel->FDMDatabaseInit( asFileName.c_str());
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- Application->MessageBox( " Initialize NVRAM database fail", "Fail", MB_OK );
- return false;
- }
- return true;
- #endif
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::write_APC_files_setup( AnsiString asSetupFile, AnsiString asExeName )
- {
- AnsiString asPath;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- TIniFile *ini;
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini != NULL)
- {
- ini->WriteString("RF tool","NVRAM database file", m_stNVRAMDB->Caption );
- delete ini;
- ini = NULL;
- }
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " RF tool : write setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::CNF_NVRAM_Init(void)
- {
- if (!NVRAMMan->Get_IsInit())
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox("Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK);
- return;
- }
- m_stNVRAMDB->Caption = NVRAMMan->Get_NVRAM_DB_File();
- switch (m_eNvramTrigger)
- {
- case NVRAM_TRIGGER_CHANGE_DB:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- CurrentPageReset();
- }
- break;
- case NVRAM_TRIGGER_READ:
- {
- UploadFromFlash();
- }
- break;
- case NVRAM_TRIGGER_WRITE:
- {
- DownloadToFlash();
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnUploadFromFlashClick(TObject *Sender)
- {
- CurrentPageLock();
- if (!NVRAMMan->Get_IsInit())
- {
- if (!m_dlgOpenDB->Execute())
- {
- return;
- }
- m_eNvramTrigger = NVRAM_TRIGGER_READ;
- NVRAMMan->ConfirmCallback = ::CNF_NVRAM_Init;
- NVRAMMan->REQ_Init(m_dlgOpenDB->FileName);
- }
- else
- {
- UploadFromFlash();
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::UploadFromFlash(void)
- {
- RF_APC_Obj->ConfirmCallback = ::CNF_ReadFromNVRAM;
- RF_APC_Obj->REQ_Read_APC_From_NVRAM_Start(m_uiFinalRFID, m_bTADOSupport);
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::CNF_ReadFromNVRAM(void)
- {
- PostMessage(this->Handle,
- WM_ML_NVRAM_READ_GMSK_APC_CNF,
- 0,
- 0
- );
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::UploadFromFlashDone(void)
- {
- E_METAAPP_RESULT_T state = RF_APC_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- int total_band_num;
- if (frmMainSel->cbGSM850->Checked)
- {
- total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (int band=0; band<total_band_num; band++)
- {
- m_usHighApcDcOffset[band] = RF_APC_Obj->Get_HighApcDcOffset(band);
- if (m_bTADOSupport)
- {
- m_usLowApcDcOffset[band] = RF_APC_Obj->Get_LowApcDcOffset(band);
- ApcLowestPower[band] = RF_APC_Obj->Get_ApcLowestPower(band);
- }
- l1cal_rampTable_T* ramp_table = RF_APC_Obj->Get_ApcProfile(band);
- m_sRFCal_RamTable[band] = *ramp_table;
- }
- if (RampDataChange(&m_sRFCal_RamTable[m_eCurBand], &m_sOldRFCal_RamTable[m_eCurBand]))
- {
- for (int band=0; band<total_band_num; band++)
- {
- m_sOldRFCal_RamTable[band] = m_sRFCal_RamTable[band];
- }
- for (int band=0; band<total_band_num; band++)
- {
- for (int i=0; i<3; i++)
- {
- for (int j=0; j<3; j++)
- {
- m_sOldRFCal_RamTable[band].rampData.battery_compensate[i][j] = m_sRFCal_RamTable[band].rampData.battery_compensate[i][j] ;
- }
- }
- }
- PlotCurve(PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE);
- }
- ReDrawFields(DRAW_GUI_PCL|DRAW_GUI_RAMP);
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Upload APC profile from flash, please check 1. GSM850 support. 2. The version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload APC profile from flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash stop";
- Application->MessageBox( "Execution Timeout : Upload APC profile from flash", "STOP", MB_OK );
- }
- break;
- }
- CurrentPageReset();
- }
- //==============================================================================
- void TfrmGUIApcProfile::ReDrawFields( int draw_mask )
- {
- int i, j;
- int band = m_eCurBand;
- char str[256];
- edtTestArfcn->Text = m_sTestArfcn[band];
- edtHighApcDcOffset->Text = m_usHighApcDcOffset[band];
- if( m_bTADOSupport )
- {
- edtLowApcDcOffset->Text = m_usLowApcDcOffset[band];
- edtAPCLowestPower->Text = ApcLowestPower[band];
- }
- if( band!=BANDSEL_GSM900 && band!=BANDSEL_GSM850 )
- {
- edtPCLDAC[15]->Visible = true;
- btnPCL[15]->Visible = true;
- }
- else
- {
- edtPCLDAC[15]->Visible = false;
- btnPCL[15]->Visible = false;
- }
- if(draw_mask & DRAW_GUI_PCL)
- {
- for(i=0; i<16; i++)
- {
- edtPCLDAC[i]->Text = m_sRFCal_RamTable[band].rampData.power[i];
- btnPCL[i]->Caption = PCL_RANGE[band][i];
- }
- }
- if(draw_mask & DRAW_GUI_RAMP)
- {
- sprintf(str, "PCL %d Profile", PCL_RANGE[m_eCurBand][m_sCurPCLIndex]);
- pnlProfileTItle->Caption = str;
- for(i=0; i<16; i++)
- {
- edtRampUp[i]->Text = m_sRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[0][i];
- edtRampDn[i]->Text = m_sRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[1][i];
- }
- }
- }
- //==============================================================================
- void TfrmGUIApcProfile::ClearImage( void )
- {
- imRampProfile->Canvas->Brush->Color = clWhite;
- imRampProfile->Canvas->Brush->Style = bsSolid;
- imRampProfile->Canvas->FillRect(Rect(0,0,imRampProfile->Width,imRampProfile->Height));
- }
- //--------------------------------------------------------------------------
- void TfrmGUIApcProfile::PlotCurve( int plot_mask )
- {
- // plot grid
- double min_y, max_y;
- if (plot_mask & PLOT_RAMP_GRID)
- {
- PlotGrid(0, 32, 0, 255);
- }
- // plot ramp profile curve
- if( plot_mask & PLOT_RAMP_PROFILE_CURVE )
- {
- PlotRampProfileCurve();
- PlotRampProfileCircle();
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::PlotGrid(int min_x, int max_x, int min_y, int max_y)
- {
- int i;
- double range;
- ClearImage();
- max_y_grid = max_y;
- min_y_grid = min_y - 40;
- range = max_y_grid - min_y_grid;
- for( i=1; i<=100; i++ )
- {
- vScale = i*RAMP_VSCALE_UNIT;
- if( vScale * 8 > range)
- {
- break;
- }
- }
- vDistance = imRampProfile->Height / (range +10) * vScale;
- Segments = (range / vScale) + 1;
- imRampProfile->Canvas->Pen->Color = clBlack;
- imRampProfile->Canvas->Pen->Width = 1;
- imRampProfile->Canvas->Pen->Style = psDot;
- // plot horizotal grid & label
- for( i=0; i<Segments && i<RAMP_VERTICAL_LABEL_NUM; i++ )
- {
- if( (i*vDistance + vStart) > imRampProfile->Height || (i*vScale) > MAX_RAMP_DATA_VALUE )
- {
- lblVertical[i]->Visible = true;
- lblVertical[i]->Top = imRampProfile->Top + imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale) - vStart - 5 ;
- lblVertical[i]->Left = imRampProfile->Left - 20;
- lblVertical[i]->Caption = (AnsiString) "255";
- imRampProfile->Canvas->MoveTo( 1, imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale) - vStart );
- imRampProfile->Canvas->LineTo( 1 + imRampProfile->Width, imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale) - vStart );
- Segments = i;
- break;
- }
- lblVertical[i]->Visible = true;
- lblVertical[i]->Top = imRampProfile->Top + imRampProfile->Height - i*vDistance - vStart - 5 ;
- lblVertical[i]->Left = imRampProfile->Left - 20;
- lblVertical[i]->Caption = IntToStr( i*vScale );
- imRampProfile->Canvas->MoveTo( 1, imRampProfile->Height - i*vDistance - vStart );
- imRampProfile->Canvas->LineTo( 1 + imRampProfile->Width, imRampProfile->Height - i*vDistance - vStart );
- }
- for(i=Segments+1; i<RAMP_VERTICAL_LABEL_NUM; i++)
- {
- lblVertical[i]->Visible = false;
- }
- // plot vertical grid
- lblRampUpH[0]->Left = imRampProfile->Left - 5;
- lblRampUpH[0]->Top = imRampProfile->Top + imRampProfile->Height + 5;
- lblRampUpH[0]->Caption = IntToStr(0);
- hDistance = imRampProfile->Width / TOTAL_HORIZONTAL_SAMPLE ;
- for( i=1; i<TOTAL_HORIZONTAL_SAMPLE; i++ )
- {
- imRampProfile->Canvas->MoveTo( i * hDistance, 1 );
- imRampProfile->Canvas->LineTo( i * hDistance, imRampProfile->Height );
- if( i<RAMP_UP_SAMPLE_NUM) // ramp up
- {
- lblRampUpH[i]->Left = imRampProfile->Left + i * hDistance - 5;
- lblRampUpH[i]->Top = imRampProfile->Top + imRampProfile->Height + 5;
- lblRampUpH[i]->Caption = IntToStr(i);
- }
- else if( i>=(RAMP_UP_SAMPLE_NUM+DATA_SAMPLE_NUM)) // ramp down
- {
- lblRampDownH[(i-RAMP_UP_SAMPLE_NUM-DATA_SAMPLE_NUM)]->Left = imRampProfile->Left + i * hDistance - 5;
- lblRampDownH[(i-RAMP_UP_SAMPLE_NUM-DATA_SAMPLE_NUM)]->Top = imRampProfile->Top + imRampProfile->Height + 5;
- lblRampDownH[(i-RAMP_UP_SAMPLE_NUM-DATA_SAMPLE_NUM)]->Caption = IntToStr((i-RAMP_UP_SAMPLE_NUM-DATA_SAMPLE_NUM));
- }
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::PlotRampProfileCurve( void )
- {
- int i;
- imRampProfile->Invalidate();
- // isOrgCurvePlot = true;
- imRampProfile->Canvas->Pen->Color = clBlue;
- imRampProfile->Canvas->Pen->Width = 1;
- imRampProfile->Canvas->Pen->Style = psSolid;
- // ramp up
- imRampProfile->Canvas->MoveTo(1, imRampProfile->Height - vDistance*(1.0*(m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][0])/vScale) - vStart ) ;
- for( i=0; i<RAMP_UP_SAMPLE_NUM; i++)
- {
- //Sleep(10);
- RampUpPoint.x[i] = hDistance*i;
- RampUpPoint.y[i] = imRampProfile->Height - vDistance*(1.0*( m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][i])/vScale )- vStart;
- imRampProfile->Canvas->LineTo( RampUpPoint.x[i], RampUpPoint.y[i] );
- }
- // ramp down
- imRampProfile->Canvas->MoveTo( hDistance*(RAMP_UP_SAMPLE_NUM+DATA_SAMPLE_NUM), imRampProfile->Height - vDistance*(1.0*( m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][0])/vScale) - vStart );
- for( i=0; i<RAMP_DOWN_SAMPLE_NUM; i++)
- {
- //Sleep(10);
- RampDownPoint.x[i] = hDistance*(i+RAMP_UP_SAMPLE_NUM+DATA_SAMPLE_NUM);
- RampDownPoint.y[i] = imRampProfile->Height - vDistance*(1.0*( m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][i])/vScale) - vStart;
- imRampProfile->Canvas->LineTo( RampDownPoint.x[i], RampDownPoint.y[i] );
- }
- // midamble
- imRampProfile->Canvas->Pen->Color = clPurple;
- imRampProfile->Canvas->Pen->Width = 1;
- imRampProfile->Canvas->Pen->Style = psSolid;
- imRampProfile->Canvas->MoveTo(hDistance*(RAMP_UP_SAMPLE_NUM-1), imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale )- vStart );
- imRampProfile->Canvas->LineTo(hDistance*(RAMP_UP_SAMPLE_NUM+DATA_SAMPLE_NUM), imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale )- vStart );
- }
- //------------------------------------------------------------------------------
- void TfrmGUIApcProfile::PlotRampProfileCircle( void )
- {
- imRampProfile->Canvas->Brush->Color = clLime;
- int x1;
- int y1;
- int x2;
- int y2;
- // ramp up
- for(int i=0; i<RAMP_UP_SAMPLE_NUM; i++)
- {
- //Sleep(25);
- x1 = max(RampUpPoint.x[i]-RAMP_CIRCLE_RADIOUS, 1);
- y1 = max(RampUpPoint.y[i]-RAMP_CIRCLE_RADIOUS, 1);
- x2 = min(RampUpPoint.x[i]+RAMP_CIRCLE_RADIOUS, imRampProfile->Width);
- y2 = min(RampUpPoint.y[i]+RAMP_CIRCLE_RADIOUS, imRampProfile->Height);
- imRampProfile->Canvas->Ellipse(x1, y1, x2, y2);
- }
- // ramp down
- for(int i=0; i<RAMP_DOWN_SAMPLE_NUM; i++)
- {
- //Sleep(25);
- x1 = max(RampDownPoint.x[i]-RAMP_CIRCLE_RADIOUS, 1);
- y1 = max(RampDownPoint.y[i]-RAMP_CIRCLE_RADIOUS, 1);
- x2 = min(RampDownPoint.x[i]+RAMP_CIRCLE_RADIOUS, imRampProfile->Width);
- y2 = min(RampDownPoint.y[i]+RAMP_CIRCLE_RADIOUS, imRampProfile->Height);
- imRampProfile->Canvas->Ellipse(x1, y1, x2, y2);
- }
- }
- //==============================================================================
- void __fastcall TfrmGUIApcProfile::imRampProfileDragOver(TObject *Sender,
- TObject *Source, int X, int Y, TDragState State, bool &Accept)
- {
- if( State == dsDragEnter )
- {
- CheckFields( );
- // char buf[20];
- // sprintf(buf, " (x=%d, y=%d) ", X, Y);
- // sbAudioCal->Panels->Items[0]->Text = (AnsiString) buf;
- // ramp up
- for(int i=0; i<RAMP_UP_SAMPLE_NUM; i++)
- {
- if( RampUpPoint.x[i]-RAMP_CIRCLE_RADIOUS<=X && X<=RampUpPoint.x[i]+RAMP_CIRCLE_RADIOUS &&
- RampUpPoint.y[i]-RAMP_CIRCLE_RADIOUS<=Y && Y<=RampUpPoint.y[i]+RAMP_CIRCLE_RADIOUS )
- {
- isRampUpCircleOnDrag = true;
- RampCircleOnDragIndex = i;
- if( btnTXStart->Tag == BTN_TAG_START )
- {
- p_TxStop_Event = CreateEvent(NULL, TRUE, FALSE, NULL);
- ResetEvent( p_TxStop_Event );
- btnTXStopClick( this ); // stop TX burst
- WaitForSingleObject( p_TxStop_Event, 5000 );
- }
- return;
- }
- }
- // ramp down
- for(int i=0; i<RAMP_DOWN_SAMPLE_NUM; i++)
- {
- if( RampDownPoint.x[i]-RAMP_CIRCLE_RADIOUS<=X && X<=RampDownPoint.x[i]+RAMP_CIRCLE_RADIOUS &&
- RampDownPoint.y[i]-RAMP_CIRCLE_RADIOUS<=Y && Y<=RampDownPoint.y[i]+RAMP_CIRCLE_RADIOUS )
- {
- isRampDownCircleOnDrag = true;
- RampCircleOnDragIndex = i;
- if( btnTXStart->Tag == BTN_TAG_START )
- {
- p_TxStop_Event = CreateEvent(NULL, TRUE, FALSE, NULL);
- ResetEvent( p_TxStop_Event );
- btnTXStopClick( this ); // stop TX burst
- WaitForSingleObject( p_TxStop_Event, 5000 );
- }
- return;
- }
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::imRampProfileEndDrag(TObject *Sender,
- TObject *Target, int X, int Y)
- {
- if( isRampUpCircleOnDrag || isRampDownCircleOnDrag )
- {
- int result;
- if( X == 0 && Y == 0 ) // outside image
- {
- Application->MessageBox( " Destination coordinates is outside image range", "Warning", MB_OK );
- return;
- }
- result = ImageRangeCheck(X, Y);
- if( result == OUT_OF_TOP_RANGE )
- {
- Y = imRampProfile->Height - vDistance*(1.0*(255)/vScale) - vStart;
- }
- else if( result == OUT_OF_BOTTOM_RANGE )
- {
- Y = imRampProfile->Height - vStart;
- }
- if( isRampUpCircleOnDrag ) // ramp up
- {
- RampUpPoint.y[RampCircleOnDragIndex] = Y;
- UpdateRampdata( RAMP_UP_FLAG, RampCircleOnDragIndex );
- isRampUpCircleOnDrag = false;
- }
- else if( isRampDownCircleOnDrag ) // ramp dwon
- {
- RampDownPoint.y[RampCircleOnDragIndex] = Y;
- UpdateRampdata( RAMP_DOWN_FLAG, RampCircleOnDragIndex );
- isRampDownCircleOnDrag = false;
- }
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- ReDrawFields( DRAW_GUI_RAMP );
- m_bDragTrigger = true;
- imRampProfile->Enabled = false;
- //p_TxStart_Event = CreateEvent(NULL, TRUE, FALSE, NULL);
- // ResetEvent( p_TxStart_Event );
- btnDownloadToFlashClick( this );
- //WaitForSingleObject( p_TxStart_Event, 5000 );
- }
- }
- //==============================================================================
- void TfrmGUIApcProfile::UpdateRampdata( int ramp_flag, int idx )
- {
- if( idx >= 0 )
- {
- if( ramp_flag == RAMP_UP_FLAG ) // ramp up
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][idx] = 1.0*(imRampProfile->Height -RampUpPoint.y[idx] - vStart)*vScale/vDistance;
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][idx] = m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][idx];
- }
- else // ramp down
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][idx] = 1.0*(imRampProfile->Height -RampDownPoint.y[idx] - vStart)*vScale/vDistance;
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][idx] = m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][idx];
- }
- }
- }
- //==============================================================================
- void __fastcall TfrmGUIApcProfile::btnUpRightClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=15; i>=1; i--)
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i-1];
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i-1];
- }
- ReDrawFields( DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnDnRightClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=15; i>=1; i--)
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i-1];
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i-1];
- }
- ReDrawFields( DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnUpLeftClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=0; i<15; i++)
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i+1];
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i+1];
- }
- ReDrawFields( DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnDnLeftClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=0; i<15; i++)
- {
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i+1];
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i] =
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[up_down][i+1];
- }
- ReDrawFields( DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtRampUpCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~255 ";
- text = edit->Text;
- if( !IsValidRamp( text, ucdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][edit->Tag] = ucdata;
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[0][edit->Tag] = ucdata;
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtRampDnCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~255 ";
- text = edit->Text;
- if( !IsValidRamp( text, ucdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][edit->Tag] = ucdata;
- m_sOldRFCal_RamTable[m_eCurBand].rampData.ramp[m_sCurPCLIndex].point[1][edit->Tag] = ucdata;
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::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 TfrmGUIApcProfile::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnTXStartClick(TObject *Sender)
- {
- if(btnTXStart->Tag==0)
- {
- CurrentPageLock();
- frmRFTool->CurrentPageLock();
- frmRFTool->Force_RF_Stop();
- frmRFTool->pctlToolSel->Enabled = false;
- if( t_RfSetRamp.rf_setramp.SetRampTableSupport )
- {
- int total_band_num;
- int band;
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- { total_band_num = 3;
- }
- for(band=0; band<total_band_num; band++)
- {
- RF_APC_Obj->Set_HighApcDcOffset( band, m_usHighApcDcOffset[band] );
- if( m_bTADOSupport )
- {
- RF_APC_Obj->Set_LowApcDcOffset( band, m_usLowApcDcOffset[band] );
- RF_APC_Obj->Set_ApcLowestPower( band, ApcLowestPower[band] );
- }
- RF_APC_Obj->Set_ApcProfile( band, m_sRFCal_RamTable[band] );
- }
- // RF_APC_Obj->Set_ApcProfile( m_eCurBand, m_sRFCal_RamTable[m_eCurBand] );
- RF_APC_Obj->ConfirmCallback = ::ConfirmCallback_RfSetRampTable;
- RF_APC_Obj->REQ_RfSetRampTable_Start(m_uiFinalRFID, m_bTADOSupport, m_eCurBand);
- }
- else
- {
- S_RFTX rf_tx;
- rf_tx.e_bandsel = m_eCurBand;
- rf_tx.s_RfNbTxReq.arfcn = m_sTestArfcn[m_eCurBand];
- rf_tx.s_RfNbTxReq.bsic = Tsc;
- rf_tx.s_RfNbTxReq.power = PCL_RANGE[m_eCurBand][m_sCurPCLIndex];
- rf_tx.s_RfNbTxReq.frames = -99;
- rf_tx.s_RfNbTxReq.dacValue = m_sAfcDac;
- rf_tx.s_RfNbTxReq.burstTypeNB = m_eBurstType;
- RF_TX_Obj->ConfirmCallback = ::ConfirmCallback_TX;
- RF_TX_Obj->REQ_Start(rf_tx);
- }
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX progressing";
- }
- else
- {
- // frmRFTool->Force_RF_Stop();
- // frmRFTool->pctlToolSel->Enabled = true;
- // frmRFTool->btnTXStart->Enabled = true;
- // CurrentPageReset();
- // frmRFTool->CurrentPageReset();
- // sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- }
- //-----------------------------------------------
- void TfrmGUIApcProfile::ConfirmCallback_RfSetRampTable(void)
- {
- E_METAAPP_RESULT_T state = RF_TX_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- S_RFTX rf_tx;
- rf_tx.e_bandsel = m_eCurBand;
- rf_tx.s_RfNbTxReq.arfcn = m_sTestArfcn[m_eCurBand];
- rf_tx.s_RfNbTxReq.bsic = Tsc;
- rf_tx.s_RfNbTxReq.power = PCL_RANGE[m_eCurBand][m_sCurPCLIndex];
- rf_tx.s_RfNbTxReq.frames = -99;
- rf_tx.s_RfNbTxReq.dacValue = m_sAfcDac;
- rf_tx.s_RfNbTxReq.burstTypeNB = m_eBurstType;
- RF_TX_Obj->ConfirmCallback = ::ConfirmCallback_TX;
- RF_TX_Obj->REQ_Start(rf_tx);
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX fail";
- Application->MessageBox("Execution failure : Set ramp table", "FAILURE", MB_OK);
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX timeout";
- Application->MessageBox("Execution Timeout : Set ramp table", "TIMEOUT", MB_OK);
- }
- break;
- case METAAPP_STOP:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set ramp table stop";
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtHighApcDcOffsetCheck(TObject *Sender)
- {
- unsigned short usdata;
- int band = m_eCurBand;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~1023 ";
- text = edit->Text;
- if (!IsValidPCLDac(text, usdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_usHighApcDcOffset[band] = usdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::OnBtnPclClick(TObject *Sender)
- {
- if(btnTXStart->Tag==1)
- { btnTXStartClick(this);
- }
- m_sCurPCLIndex = (*(TComponent*)Sender).Tag;
- ReDrawFields( DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::tctlAPCChange(TObject *Sender)
- {
- if (!frmMainSel->cbGSM850->Checked)
- {
- if (BANDSEL_GSM850 == (E_BANDSEL) tctlAPC->TabIndex)
- {
- tctlAPC->TabIndex = lastTabIndex;
- Application->MessageBox( "Please check GSM 850 on main menu", "FAILURE", MB_OK );
- return;
- }
- }
- if( !CheckFields() )
- {
- tctlAPC->TabIndex = m_eCurBand;
- return;
- }
- if(btnTXStart->Tag)
- {
- btnTXStopClick(this);
- }
- m_eCurBand = (E_BANDSEL)tctlAPC->TabIndex;
- lastTabIndex = tctlAPC->TabIndex;
- m_sCurPCLIndex = 0;
- ReDrawFields( DRAW_GUI_PCL|DRAW_GUI_RAMP );
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- //---------------------------------------------------------------------------
- bool TfrmGUIApcProfile::CheckFields( void )
- {
- int i;
- int idata;
- unsigned short usdata;
- unsigned char ucdata;
- E_BANDSEL band = m_eCurBand;
- AnsiString text;
- for(i=0; i<16; i++)
- {
- text = edtPCLDAC[i]->Text; if (!IsValidPCLDac(text, usdata)) { edtPCLDACCheck(edtPCLDAC[i]); return(false); }
- m_sRFCal_RamTable[band].rampData.power[i] = usdata;
- text = edtRampUp[i]->Text; if (!IsValidRamp(text, ucdata)) { edtRampUpCheck(edtRampUp[i]); return(false); }
- m_sRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[0][i] = ucdata;
- m_sOldRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[0][i] = ucdata;
- text = edtRampDn[i]->Text; if (!IsValidRamp(text, ucdata)) { edtRampDnCheck(edtRampDn[i]); return(false); }
- m_sRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[1][i] = ucdata;
- m_sOldRFCal_RamTable[band].rampData.ramp[m_sCurPCLIndex].point[1][i] = ucdata;
- }
- text = edtTestArfcn->Text; if( !IsValidARFCN( text, band, m_sTestArfcn[band] ) ) { edtTestArfcnCheck(edtTestArfcn); return(false); }
- text = edtHighApcDcOffset->Text; if (!IsValidPCLDac(text, m_usHighApcDcOffset[band])) { edtHighApcDcOffsetCheck(edtHighApcDcOffset); return(false); }
- if( m_bTADOSupport )
- {
- text = edtLowApcDcOffset->Text; if (!IsValidPCLDac( text, m_usLowApcDcOffset[band])) { edtHighApcDcOffsetCheck(edtLowApcDcOffset); return(false); }
- text = edtAPCLowestPower->Text; if( !IsValidApcLowestPower( text, m_eCurBand, ApcLowestPower[band] ) ) { edtAPCLowestPowerCheck(edtAPCLowestPower); return(false); }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtPCLDACCheck(TObject *Sender)
- {
- int i;
- unsigned short usdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~1023 ";
- text = edit->Text;
- if (!IsValidPCLDac(text, usdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_sRFCal_RamTable[m_eCurBand].rampData.power[edit->Tag] = usdata;
- m_sOldRFCal_RamTable[m_eCurBand].rampData.power[edit->Tag] = usdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtTestArfcnCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- { " value shall be 0~124 or 975~1023 ",
- " value shall be 512~885 ",
- " value shall be 512~810 ",
- " value shall be 128~251 ",
- };
- text = edit->Text;
- if (!IsValidARFCN(text, m_eCurBand, sdata))
- { ShowHintLabel(edit, hint[m_eCurBand]);
- edit->SetFocus();
- return;
- }
- m_sTestArfcn[m_eCurBand] = sdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnDownloadToFlashClick(TObject *Sender)
- {
- if (!m_bDragTrigger)
- {
- CurrentPageLock();
- }
- if (!CheckFields())
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash fail";
- Application->MessageBox("Execution Failure : Download APC profile to flash", "FAILURE", MB_OK);
- CurrentPageReset();
- return;
- }
- if (!NVRAMMan->Get_IsInit())
- {
- if (!m_dlgOpenDB->Execute())
- {
- return;
- }
- m_eNvramTrigger = NVRAM_TRIGGER_WRITE;
- NVRAMMan->ConfirmCallback = ::CNF_NVRAM_Init;
- NVRAMMan->REQ_Init(m_dlgOpenDB->FileName);
- }
- else
- {
- DownloadToFlash();
- }
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::DownloadToFlash(void)
- {
- int band;
- int total_band_num;
- if (frmMainSel->cbGSM850->Checked)
- {
- total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (band=0; band<total_band_num; band++)
- {
- RF_APC_Obj->Set_HighApcDcOffset(band, m_usHighApcDcOffset[band]);
- if (m_bTADOSupport)
- {
- RF_APC_Obj->Set_LowApcDcOffset(band, m_usLowApcDcOffset[band]);
- RF_APC_Obj->Set_ApcLowestPower(band, ApcLowestPower[band]);
- }
- RF_APC_Obj->Set_ApcProfile(band, m_sRFCal_RamTable[band]);
- }
- RF_APC_Obj->ConfirmCallback = ::CNF_WriteToNVRAM;
- RF_APC_Obj->REQ_Write_APC_To_NVRAM_Start(m_uiFinalRFID, m_bTADOSupport);
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::DownloadToFlashDone(void)
- {
- E_METAAPP_RESULT_T state = RF_APC_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash successfully";
- if (m_bDragTrigger)
- {
- btnTXStartClick(this);
- }
- }
- break;
- case METAAPP_FAIL:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox("Execution Failure : Download APC profile to flash, please check 1. GSM850 support. 2. The version of load and NVRAM database are same.", "FAILURE", MB_OK);
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash timeout";
- Application->MessageBox("Execution Timeout : Download APC profile to flash", "TIMEOUT", MB_OK);
- }
- break;
- case METAAPP_STOP:
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash stop";
- }
- break;
- default:
- {
- }
- break;
- }
- if (!m_bDragTrigger)
- {
- CurrentPageReset();
- }
- }
- //==============================================================================
- void __fastcall TfrmGUIApcProfile::btnLoadFromFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int band;
- int total_band_num;
- ok = OpenDialog->Execute();
- if( !ok )
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file fail";
- Application->MessageBox( "Execution Failure : Load APC profile from file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, OpenDialog->FileName.c_str() );
- ok = RF_APC_Obj->REQ_Read_APC_From_File(str, m_uiFinalRFID, m_bTADOSupport);
- if( ok )
- {
- if(frmMainSel->cbGSM850->Checked)
- //frmMainSel->Get_FinalBandSupport( band_support );
- //if( band_support.GSM850 )
- {
- total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (band=0; band<total_band_num; band++)
- {
- // ApcDcOffset[band] = RF_APC_Obj->ApcDcOffset[band];
- // m_sRFCal_RamTable[band] = RF_APC_Obj->ApcProfile[band];
- m_usHighApcDcOffset[band] = RF_APC_Obj->Get_HighApcDcOffset( band );
- if( m_bTADOSupport )
- {
- m_usLowApcDcOffset[band] = RF_APC_Obj->Get_LowApcDcOffset(band);
- ApcLowestPower[band] = RF_APC_Obj->Get_ApcLowestPower(band);
- }
- l1cal_rampTable_T* p_ramp_table = RF_APC_Obj->Get_ApcProfile(band);
- m_sRFCal_RamTable[band] = *p_ramp_table;
- }
- if( RampDataChange( &m_sRFCal_RamTable[m_eCurBand], &m_sOldRFCal_RamTable[m_eCurBand] ) )
- {
- for(band=0; band<total_band_num; band++)
- {
- m_sOldRFCal_RamTable[band] = m_sRFCal_RamTable[band];
- }
- PlotCurve( PLOT_RAMP_GRID | PLOT_RAMP_PROFILE_CURVE );
- }
- ReDrawFields(DRAW_GUI_PCL|DRAW_GUI_RAMP);
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file successfully";
- }
- else
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file fail";
- Application->MessageBox( "Execution Failure : Load APC profile from file", "FAILURE", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnSaveToFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int band;
- int total_band_num;
- ok = CheckFields();
- if(!ok)
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- if(frmMainSel->cbGSM850->Checked)
- //frmMainSel->Get_FinalBandSupport( band_support );
- //if( band_support.GSM850 )
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for(band=0; band<total_band_num; band++)
- {
- // RF_APC_Obj->ApcDcOffset[band] = ApcDcOffset[band];
- // RF_APC_Obj->ApcProfile[band] = m_sRFCal_RamTable[band];
- RF_APC_Obj->Set_HighApcDcOffset( band, m_usHighApcDcOffset[band] );
- if( m_bTADOSupport )
- {
- RF_APC_Obj->Set_LowApcDcOffset( band, m_usLowApcDcOffset[band] );
- RF_APC_Obj->Set_ApcLowestPower(band, ApcLowestPower[band]);
- }
- RF_APC_Obj->Set_ApcProfile( band, m_sRFCal_RamTable[band] );
- }
- strcpy( str, SaveDialog->FileName.c_str() );
- m_uiFinalRFID = frmMainSel->Get_FinalRFID();
- ok = RF_APC_Obj->REQ_Write_APC_To_File(str, m_uiFinalRFID, m_bTADOSupport);
- if( !ok )
- {
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file successfully";
- }
- //==============================================================================
- void __fastcall TfrmGUIApcProfile::btnTXProfileSettingClick(
- TObject *Sender)
- {
- frmApcProfile->Top = 4;
- frmApcProfile->Left = 152;
- frmApcProfile->Show();
- }
- //==============================================================================
- void TfrmGUIApcProfile::CurrentPageLock( void )
- {
- int i;
- // button
- // btnTXStart->Kind = bkNo;
- // btnTXStart->Caption = "Stop";
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- btnUpLeft->Enabled = false;
- btnDnLeft->Enabled = false;
- btnUpRight->Enabled = false;
- btnDnRight->Enabled = false;
- btnUploadFromFlash->Enabled = false;
- btnDownloadToFlash->Enabled = false;
- btnChangeDB->Enabled = false;
- btnLoadFromFile->Enabled = false;
- btnSaveToFile->Enabled = false;
- for(i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- {
- btnPCL[i]->Enabled = false;
- }
- // editor
- edtHighApcDcOffset->Enabled = false;
- edtLowApcDcOffset->Enabled = false;
- edtAPCLowestPower->Enabled = false;
- edtTestArfcn->Enabled = false;
- // PCL DAC
- for( i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- { edtPCLDAC[i]->Enabled = false;
- }
- // Ramp up, ramp down
- for( i=0; i<TOTAL_RAMP_DOWN_NUM; i++ )
- {
- edtRampUp[i]->Enabled = false;
- edtRampDn[i]->Enabled = false;
- }
- }
- //----------------------------------------------------------------------------
- void TfrmGUIApcProfile::CurrentPageReset( void )
- {
- int i;
- // button
- // btnTXStart->Kind = bkRetry;
- // btnTXStart->Caption = "Start";
- btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- btnUpLeft->Enabled = true;
- btnDnLeft->Enabled = true;
- btnUpRight->Enabled = true;
- btnDnRight->Enabled = true;
- btnUploadFromFlash->Enabled = true;
- btnDownloadToFlash->Enabled = true;
- btnChangeDB->Enabled = true;
- btnLoadFromFile->Enabled = true;
- btnSaveToFile->Enabled = true;
- for(i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- {
- btnPCL[i]->Enabled = true;
- }
- // editor
- edtHighApcDcOffset->Enabled = true;
- edtLowApcDcOffset->Enabled = true;
- edtAPCLowestPower->Enabled = true;
- edtTestArfcn->Enabled = true;
- // PCL DAC
- for( i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- { edtPCLDAC[i]->Enabled = true;
- }
- // Ramp up, ramp down
- for( i=0; i<TOTAL_RAMP_DOWN_NUM; i++ )
- {
- edtRampUp[i]->Enabled = true;
- edtRampDn[i]->Enabled = true;
- }
- }
- //==============================================================================
- int TfrmGUIApcProfile::ImageRangeCheck( int X, int Y )
- {
- sRfImageRange ImageRange;
- getImageValidRange(&ImageRange);
- // if( X < ImageRange.LeftTop.x )
- // {
- // return OUT_OF_LEFT_RANGE;
- // }
- // else if( X > ImageRange.RightBottom.x )
- // {
- // return OUT_OF_RIGHT_RANGE;
- // }
- if( Y <= ImageRange.LeftTop.y )
- {
- return OUT_OF_TOP_RANGE;
- }
- else if( Y >= ImageRange.RightBottom.y )
- {
- return OUT_OF_BOTTOM_RANGE;
- }
- return IN_RANGE;
- }
- //-------------------------------------------------------------------------
- void TfrmGUIApcProfile::getImageValidRange( sRfImageRange *p_ImageRange )
- {
- p_ImageRange->LeftTop.x = 1;
- p_ImageRange->LeftTop.y = imRampProfile->Height - vDistance*(1.0*MAX_RAMP_DATA_VALUE/vScale) - vStart;
- p_ImageRange->RightBottom.x = (TOTAL_HORIZONTAL_SAMPLE-1)*hDistance;
- p_ImageRange->RightBottom.y = imRampProfile->Height - vStart;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::FormHide(TObject *Sender)
- {
- if (BTN_TAG_START == btnTXStart->Tag)
- {
- btnTXStopClick(this);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::btnChangeDBClick(TObject *Sender)
- {
- if (!m_dlgOpenDB->Execute())
- {
- return;
- }
- CurrentPageLock();
- m_eNvramTrigger = NVRAM_TRIGGER_CHANGE_DB;
- NVRAMMan->ConfirmCallback = ::CNF_NVRAM_Init;
- NVRAMMan->REQ_Init(m_dlgOpenDB->FileName);
- }
- //---------------------------------------------------------------------------
- bool TfrmGUIApcProfile::RampDataChange(l1cal_rampTable_T *p_RFCal_RamTable1, l1cal_rampTable_T *p_RFCal_RamTable2)
- {
- for(int i=0; i<=15; i++)
- {
- if( p_RFCal_RamTable1->rampData.ramp[m_sCurPCLIndex].point[0][i] !=
- p_RFCal_RamTable2->rampData.ramp[m_sCurPCLIndex].point[0][i]
- )
- {
- return true;
- }
- if( p_RFCal_RamTable1->rampData.ramp[m_sCurPCLIndex].point[1][i] !=
- p_RFCal_RamTable2->rampData.ramp[m_sCurPCLIndex].point[1][i]
- )
- {
- return true;
- }
- }
- return false;
- }
- void __fastcall TfrmGUIApcProfile::btnTXStopClick(TObject *Sender)
- {
- if(btnTXStart->Tag==1)
- {
- frmRFTool->Force_RF_Stop();
- frmRFTool->pctlToolSel->Enabled = true;
- frmRFTool->btnTXStart->Enabled = true;
- CurrentPageReset();
- frmRFTool->CurrentPageReset();
- sbGUIAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if( m_stNVRAMDB->Caption.AnsiCompareIC("") != 0 )
- {
- write_APC_files_setup( "MF_setup.txt", Application->ExeName );
- }
- if (BTN_TAG_START == btnTXStart->Tag)
- {
- btnTXStopClick(this);
- }
- }
- //===========================================================================
- ///////////////////////////// Query ////////////////////////////
- //===========================================================================
- void __fastcall TfrmGUIApcProfile::on_QueryTwoApcDcOffset_Fail(TObject *Sender)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::on_QueryTwoApcDcOffset_TerminateSuccess(TObject *Sender)
- {
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::Query_TwoApcDcOffset_Support( void )
- {
- t_RfTado.hPostMsgDestHandle = this->Handle;
- t_RfTado.ne_onTermSuccess = on_QueryTwoApcDcOffset_TerminateSuccess;
- pt_rftado = new T_RFTADO(
- true,
- &t_RfTado);
- if(pt_rftado != NULL)
- {
- pt_rftado->FreeOnTerminate = true;
- pt_rftado->OnTerminate = on_QueryTwoApcDcOffset_Fail;
- pt_rftado->Priority = tpHighest;
- pt_rftado->Resume();
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmGUIApcProfile::on_QueryRfSetRampTableSupport_Fail(TObject *Sender)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::on_QueryRfSetRampTableSupport_TerminateSuccess(TObject *Sender)
- {
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::Query_RfSetRampTable_Support( void )
- {
- t_RfSetRamp.hPostMsgDestHandle = this->Handle;
- t_RfSetRamp.ne_onTermSuccess = on_QueryRfSetRampTableSupport_TerminateSuccess;
- pt_rfsetramp = new T_RFSETRAMP(
- true,
- &t_RfSetRamp);
- if(pt_rfsetramp != NULL)
- {
- pt_rfsetramp->FreeOnTerminate = true;
- pt_rfsetramp->OnTerminate = on_QueryRfSetRampTableSupport_Fail;
- pt_rfsetramp->Priority = tpHighest;
- pt_rfsetramp->Resume();
- }
- }
- //--------------------------------------------------------------------------
- void TfrmGUIApcProfile::DisplayTADOUI( bool b_tado_support )
- {
- if( b_tado_support )
- {
- lblLowApcDcOffset->Visible = true;
- edtLowApcDcOffset->Visible = true;
- lblAPCLowestPower->Visible = true;
- edtAPCLowestPower->Visible = true;
- }
- else
- {
- lblLowApcDcOffset->Visible = false;
- edtLowApcDcOffset->Visible = false;
- lblAPCLowestPower->Visible = false;
- edtAPCLowestPower->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtLowApcDcOffsetCheck(TObject *Sender)
- {
- unsigned short usdata;
- int band = m_eCurBand;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~1023 ";
- text = edit->Text;
- if (!IsValidPCLDac(text, usdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_usLowApcDcOffset[band] = usdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmGUIApcProfile::edtAPCLowestPowerCheck(TObject *Sender)
- {
- int i_data;
- int band = m_eCurBand;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 0~36 ",
- " value shall be 0~33 ",
- " value shall be 0~33 ",
- " value shall be 0~36 ",
- };
- text = edit->Text;
- if( !IsValidApcLowestPower( text, m_eCurBand, i_data ) )
- { ShowHintLabel( edit, hint[m_eCurBand] );
- edit->SetFocus();
- return;
- }
- ApcLowestPower[band] = i_data;
- }
- //---------------------------------------------------------------------------
- //===========================================================================
- ///////////////////////////// Global information //////////////////////////
- //===========================================================================
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::Set_RF_APC_Obj( CRFAPC *rf_apc_obj)
- {
- RF_APC_Obj = rf_apc_obj;
- }
- //---------------------------------------------------------------------------
- void TfrmGUIApcProfile::Set_RF_TX_Obj( CRFTX *rf_tx_obj)
- {
- RF_TX_Obj = rf_tx_obj;
- }