form_EpskInterSlotRampSetting.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:31k
源码类别:
MTK
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- // form
- #include "form_EpskInterSlotRampSetting.h"
- #include "form_main.h"
- #ifndef _MISC_H_
- #include "misc.h"
- #endif
- #ifndef _FORM_RFTOOL_H_
- #include "form_rftool.h"
- #endif
- #include "man_fdm.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- #define IDX_GG 0
- #define IDX_GE 1
- #define IDX_EG 2
- #define IDX_EE 3
- TfrmEpskInterSlotRampSetting *frmEpskInterSlotRampSetting;
- //=============================================================================
- static void CNF_WriteToNVRAM( void )
- { frmEpskInterSlotRampSetting->DownloadToFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_ReadFromNVRAM( void )
- { frmEpskInterSlotRampSetting->UploadFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void ConfirmCallback_MultiSlotTX( void )
- {
- frmEpskInterSlotRampSetting->ConfirmCallback_MultiSlotTX();
- }
- //---------------------------------------------------------------------------
- __fastcall TfrmEpskInterSlotRampSetting::TfrmEpskInterSlotRampSetting(TComponent* Owner)
- : TForm(Owner)
- {
- m_sTestArfcn[BANDSEL_GSM900 ] = 0;
- m_sTestArfcn[BANDSEL_DCS1800] = 512;
- m_sTestArfcn[BANDSEL_PCS1900] = 512;
- m_sTestArfcn[BANDSEL_GSM850 ] = 128;
- m_iLastTabIndex = BANDSEL_GSM900; // GSM 900
- edtInterRamp[IDX_GG][ 0]=edtGGInterRamp00;
- edtInterRamp[IDX_GG][ 1]=edtGGInterRamp01;
- edtInterRamp[IDX_GG][ 2]=edtGGInterRamp02;
- edtInterRamp[IDX_GG][ 3]=edtGGInterRamp03;
- edtInterRamp[IDX_GG][ 4]=edtGGInterRamp04;
- edtInterRamp[IDX_GG][ 5]=edtGGInterRamp05;
- edtInterRamp[IDX_GG][ 6]=edtGGInterRamp06;
- edtInterRamp[IDX_GG][ 7]=edtGGInterRamp07;
- edtInterRamp[IDX_GG][ 8]=edtGGInterRamp08;
- edtInterRamp[IDX_GG][ 9]=edtGGInterRamp09;
- edtInterRamp[IDX_GG][10]=edtGGInterRamp10;
- edtInterRamp[IDX_GG][11]=edtGGInterRamp11;
- edtInterRamp[IDX_GG][12]=edtGGInterRamp12;
- edtInterRamp[IDX_GG][13]=edtGGInterRamp13;
- edtInterRamp[IDX_GG][14]=edtGGInterRamp14;
- edtInterRamp[IDX_GG][15]=edtGGInterRamp15;
- edtInterRamp[IDX_GE][ 0]=edtGEInterRamp00;
- edtInterRamp[IDX_GE][ 1]=edtGEInterRamp01;
- edtInterRamp[IDX_GE][ 2]=edtGEInterRamp02;
- edtInterRamp[IDX_GE][ 3]=edtGEInterRamp03;
- edtInterRamp[IDX_GE][ 4]=edtGEInterRamp04;
- edtInterRamp[IDX_GE][ 5]=edtGEInterRamp05;
- edtInterRamp[IDX_GE][ 6]=edtGEInterRamp06;
- edtInterRamp[IDX_GE][ 7]=edtGEInterRamp07;
- edtInterRamp[IDX_GE][ 8]=edtGEInterRamp08;
- edtInterRamp[IDX_GE][ 9]=edtGEInterRamp09;
- edtInterRamp[IDX_GE][10]=edtGEInterRamp10;
- edtInterRamp[IDX_GE][11]=edtGEInterRamp11;
- edtInterRamp[IDX_GE][12]=edtGEInterRamp12;
- edtInterRamp[IDX_GE][13]=edtGEInterRamp13;
- edtInterRamp[IDX_GE][14]=edtGEInterRamp14;
- edtInterRamp[IDX_GE][15]=edtGEInterRamp15;
- edtInterRamp[IDX_EG][ 0]=edtEGInterRamp00;
- edtInterRamp[IDX_EG][ 1]=edtEGInterRamp01;
- edtInterRamp[IDX_EG][ 2]=edtEGInterRamp02;
- edtInterRamp[IDX_EG][ 3]=edtEGInterRamp03;
- edtInterRamp[IDX_EG][ 4]=edtEGInterRamp04;
- edtInterRamp[IDX_EG][ 5]=edtEGInterRamp05;
- edtInterRamp[IDX_EG][ 6]=edtEGInterRamp06;
- edtInterRamp[IDX_EG][ 7]=edtEGInterRamp07;
- edtInterRamp[IDX_EG][ 8]=edtEGInterRamp08;
- edtInterRamp[IDX_EG][ 9]=edtEGInterRamp09;
- edtInterRamp[IDX_EG][10]=edtEGInterRamp10;
- edtInterRamp[IDX_EG][11]=edtEGInterRamp11;
- edtInterRamp[IDX_EG][12]=edtEGInterRamp12;
- edtInterRamp[IDX_EG][13]=edtEGInterRamp13;
- edtInterRamp[IDX_EG][14]=edtEGInterRamp14;
- edtInterRamp[IDX_EG][15]=edtEGInterRamp15;
- edtInterRamp[IDX_EE][ 0]=edtEEInterRamp00;
- edtInterRamp[IDX_EE][ 1]=edtEEInterRamp01;
- edtInterRamp[IDX_EE][ 2]=edtEEInterRamp02;
- edtInterRamp[IDX_EE][ 3]=edtEEInterRamp03;
- edtInterRamp[IDX_EE][ 4]=edtEEInterRamp04;
- edtInterRamp[IDX_EE][ 5]=edtEEInterRamp05;
- edtInterRamp[IDX_EE][ 6]=edtEEInterRamp06;
- edtInterRamp[IDX_EE][ 7]=edtEEInterRamp07;
- edtInterRamp[IDX_EE][ 8]=edtEEInterRamp08;
- edtInterRamp[IDX_EE][ 9]=edtEEInterRamp09;
- edtInterRamp[IDX_EE][10]=edtEEInterRamp10;
- edtInterRamp[IDX_EE][11]=edtEEInterRamp11;
- edtInterRamp[IDX_EE][12]=edtEEInterRamp12;
- edtInterRamp[IDX_EE][13]=edtEEInterRamp13;
- edtInterRamp[IDX_EE][14]=edtEEInterRamp14;
- edtInterRamp[IDX_EE][15]=edtEEInterRamp15;
- }
- //===========================================================================
- void TfrmEpskInterSlotRampSetting::Init(void)
- {
- m_bInit = true;
- }
- //----------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::FormCreate(TObject *Sender)
- {
- m_iLastTabIndex = tclEpskInterRamp->TabIndex;
- Init();
- }
- //----------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- m_bMultiSlotTxExSupport = frmRFTool->Get_MultiSlotTxExSupport();
- }
- }
- //---------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::ReDrawFields( void )
- {
- int i;
- int section;
- int band = m_eCurBand;
- for(i=0; i<16; i++)
- {
- for( section=0; section<EPSK_INTER_RAMP_SECTION_NUM; section++ )
- { edtInterRamp[section][i]->Text = EPSK_Inter_RamTable[band].EPSK_interRampData[section][i];
- }
- }
- }
- //--------------------------------------------------------------------------
- bool TfrmEpskInterSlotRampSetting::CheckFields( void )
- {
- int i;
- unsigned char ucdata[16];
- int band = m_eCurBand;
- AnsiString text;
- for(i=0; i<16; i++)
- {
- text = edtInterRamp[IDX_GG][i]->Text; if( !IsValidRamp( text, ucdata[i] ) ) { edtGGInterRampCheck(edtInterRamp[IDX_GG][i]); return false; }
- EPSK_Inter_RamTable[band].EPSK_interRampData[IDX_GG][i] = ucdata[i];
- text = edtInterRamp[IDX_GE][i]->Text; if( !IsValidRamp( text, ucdata[i] ) ) { edtGGInterRampCheck(edtInterRamp[IDX_GE][i]); return false; }
- EPSK_Inter_RamTable[band].EPSK_interRampData[IDX_GE][i] = ucdata[i];
- text = edtInterRamp[IDX_EG][i]->Text; if( !IsValidRamp( text, ucdata[i] ) ) { edtGGInterRampCheck(edtInterRamp[IDX_EG][i]); return false; }
- EPSK_Inter_RamTable[band].EPSK_interRampData[IDX_EG][i] = ucdata[i];
- text = edtInterRamp[IDX_EE][i]->Text; if( !IsValidRamp( text, ucdata[i] ) ) { edtGGInterRampCheck(edtInterRamp[IDX_EE][i]); return false; }
- EPSK_Inter_RamTable[band].EPSK_interRampData[IDX_EE][i] = ucdata[i];
- }
- return(true);
- }
- //---------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::CurrentPageLock( void )
- {
- // button
- // btnTXStart->Kind = bkNo;
- // btnTXStart->Caption = "Stop";
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- btnGGLeft->Enabled = false;
- btnGGRight->Enabled = false;
- btnGELeft->Enabled = false;
- btnGERight->Enabled = false;
- btnEGLeft->Enabled = false;
- btnEGRight->Enabled = false;
- btnEELeft->Enabled = false;
- btnEERight->Enabled = false;
- btnUploadFromFlash->Enabled = false;
- btnDownloadToFlash->Enabled = false;
- btnChangeDB->Enabled = false;
- btnLoadFromFile->Enabled = false;
- btnSaveToFile->Enabled = false;
- }
- //----------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::CurrentPageReset( void )
- {
- // button
- // btnTXStart->Kind = bkRetry;
- // btnTXStart->Caption = "Start";
- btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- btnGGLeft->Enabled = true;
- btnGGRight->Enabled = true;
- btnGELeft->Enabled = true;
- btnGERight->Enabled = true;
- btnEGLeft->Enabled = true;
- btnEGRight->Enabled = true;
- btnEELeft->Enabled = true;
- btnEERight->Enabled = true;
- btnUploadFromFlash->Enabled = true;
- btnDownloadToFlash->Enabled = true;
- btnChangeDB->Enabled = true;
- btnLoadFromFile->Enabled = true;
- btnSaveToFile->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::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 TfrmEpskInterSlotRampSetting::HintTimerTimer(
- TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnGGLeftClick(
- TObject *Sender)
- {
- int i;
- for(i=0; i<15; i++)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GG][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GG][i+1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnGGRightClick(
- TObject *Sender)
- {
- int i;
- for(i=15; i>=1; i--)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GG][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GG][i-1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnGELeftClick(
- TObject *Sender)
- {
- for(int i=0; i<15; i++)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GE][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GE][i+1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnGERightClick(
- TObject *Sender)
- {
- int i;
- for(i=15; i>=1; i--)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GE][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GE][i-1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnEGLeftClick(
- TObject *Sender)
- {
- for(int i=0; i<15; i++)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EG][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EG][i+1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnEGRightClick(
- TObject *Sender)
- {
- int i;
- for(i=15; i>=1; i--)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EG][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EG][i-1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnEELeftClick(
- TObject *Sender)
- {
- for(int i=0; i<15; i++)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EE][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EE][i+1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnEERightClick(
- TObject *Sender)
- {
- int i;
- for(i=15; i>=1; i--)
- {
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EE][i] =
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EE][i-1];
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::edtGGInterRampCheck(
- 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;
- }
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GG][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::edtGEInterRampCheck(
- 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;
- }
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_GE][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::edtEGInterRampCheck(
- 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;
- }
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EG][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::edtEEInterRampCheck(
- 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;
- }
- EPSK_Inter_RamTable[m_eCurBand].EPSK_interRampData[IDX_EE][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnUploadFromFlashClick(
- TObject *Sender)
- {
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.ConfirmCallback = ::CNF_ReadFromNVRAM;
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.REQ_Read_From_NVRAM();
- CurrentPageLock();
- }
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::UploadFromFlashDone( void )
- {
- E_METAAPP_RESULT_T state = m_RF_EPSK_INTER_SLOT_RAMP_Obj.Get_ConfirmState();
- int band, i;
- if( METAAPP_SUCCESS == state )
- {
- 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++)
- {
- EPSK_Inter_RamTable[band] = m_RF_EPSK_INTER_SLOT_RAMP_Obj.Get_InterSlotRamp(band);
- }
- ReDrawFields();
- sbISR->Panels->Items[0]->Text = (AnsiString) " Upload inter slot ramp profile from flash successfully";
- }
- else if( METAAPP_FAIL == state )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Upload inter slot ramp profile 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 the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- else if( METAAPP_TIMEOUT == state )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Upload inter slot ramp profile from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload APC profile from flash", "TIMEOUT", MB_OK );
- }
- else if(METAAPP_STOP == state )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Upload inter slot ramp profile from flash stop";
- }
- CurrentPageReset();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnDownloadToFlashClick(
- TObject *Sender)
- {
- int band, i, section;
- int total_band_num;
- if( !CheckFields() ) return;
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for( band=0; band<total_band_num; band++ )
- {
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.Set_InterSlotRamp(band, EPSK_Inter_RamTable[band]);
- }
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.ConfirmCallback = ::CNF_WriteToNVRAM;
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.REQ_Write_To_NVRAM();
- CurrentPageLock();
- }
- //---------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::DownloadToFlashDone( void )
- {
- E_METAAPP_RESULT_T state = m_RF_EPSK_INTER_SLOT_RAMP_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Download inter slot ramp profile to flash successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Download inter slot ramp profile to flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Download inter slot ramp profile to flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Download inter slot ramp profile to flash timeout";
- Application->MessageBox( "Execution Timeout : Download inter slot ramp profile to flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Download inter slot ramp profile to flash stop";
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " NVRAM_EF_L1_EPSK_INTERSLOT_RAMP_xxx_LID version is not support, please update META to latest version";
- Application->MessageBox( "Execution Warning : NVRAM_EF_L1_EPSK_INTERSLOT_RAMP_xxx_LID version is not support, please update META to latest version", "WARNING", MB_OK );
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmEpskInterSlotRampSetting::btnChangeDBClick(
- TObject *Sender)
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- sbISR->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnLoadFromFileClick(
- TObject *Sender)
- {
- char str[512];
- bool ok;
- int band;
- int total_band_num;
- ok = OpenDialog->Execute();
- if( !ok )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Load inter slot ramp profile from file fail";
- return;
- }
- strcpy( str, OpenDialog->FileName.c_str() );
- ok = m_RF_EPSK_INTER_SLOT_RAMP_Obj.REQ_Read_From_File( str );
- if( ok )
- {
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for(band=0; band<total_band_num; band++)
- { EPSK_Inter_RamTable[band] = m_RF_EPSK_INTER_SLOT_RAMP_Obj.Get_InterSlotRamp(band);
- }
- ReDrawFields();
- sbISR->Panels->Items[0]->Text = (AnsiString) " Load inter slot ramp profile from file successfully";
- }
- else
- { Application->MessageBox( "Execution Failure : Load inter slot ramp profile from file", "FAILURE", MB_OK );
- sbISR->Panels->Items[0]->Text = (AnsiString) " Load inter slot ramp profile from file fail";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnSaveToFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int band, i;
- int total_band_num;
- ok = CheckFields();
- if(!ok)
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Save inter slot ramp profile to file fail";
- Application->MessageBox( "Execution Failure : Save inter slot ramp profile to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Save inter slot ramp profile to file fail";
- return;
- }
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for(band=0; band<total_band_num; band++)
- {
- m_RF_EPSK_INTER_SLOT_RAMP_Obj.Set_InterSlotRamp(band, EPSK_Inter_RamTable[band]);
- }
- strcpy( str, SaveDialog->FileName.c_str() );
- ok = m_RF_EPSK_INTER_SLOT_RAMP_Obj.REQ_Write_To_File( str );
- if( !ok )
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Save inter slot ramp profile to file fail";
- Application->MessageBox( "Execution Failure : Save Inter slot ramp profile to file", "FAILURE", MB_OK );
- return;
- }
- sbISR->Panels->Items[0]->Text = (AnsiString) " Save inter slot ramp profile to file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnTXStartClick(
- TObject *Sender)
- {
- E_BANDSEL band;
- short arfcn;
- int pcl[4];
- int tsc;
- short s_afc_dac;
- CodingScheme cs[4];
- int ta;
- APCTxPattern pattern;
- AnsiString text;
- //bool isEDGEsupport;
- char TimeSlotMask;
- // APCTxPattern pattern; // Tx pattern is only valid for EPSK function
- unsigned short pattern_data;
- if (btnTXStart->Tag)
- {
- return;
- }
- frmRFTool->Force_RF_Stop();
- TimeSlotMask = 0; // initial value
- if( frmRFTool->cbTimeSlot0->Checked )
- {
- TimeSlotMask = TimeSlotMask | 0x01;
- }
- if( frmRFTool->cbTimeSlot1->Checked )
- {
- TimeSlotMask = TimeSlotMask | 0x02;
- }
- if( frmRFTool->cbTimeSlot2->Checked )
- {
- TimeSlotMask = TimeSlotMask | 0x04;
- }
- if( frmRFTool->cbTimeSlot3->Checked )
- {
- TimeSlotMask = TimeSlotMask | 0x08;
- }
- band = (E_BANDSEL) frmRFTool->cbxMultiSlotTxBand->ItemIndex;
- tsc = frmRFTool->cbxMultiSlotTxTSC->ItemIndex;
- cs[0] = (CodingScheme) frmRFTool->cbxCSTS0->ItemIndex + 1;
- cs[1] = (CodingScheme) frmRFTool->cbxCSTS1->ItemIndex + 1;
- cs[2] = (CodingScheme) frmRFTool->cbxCSTS2->ItemIndex + 1;
- cs[3] = (CodingScheme) frmRFTool->cbxCSTS3->ItemIndex + 1;
- text = edtTestArfcn->Text; if( !IsValidARFCN( text, band, arfcn ) ) { edtArfcnCheck(edtTestArfcn); return; }
- text = frmRFTool->edtPCLTS0->Text; if( !IsValidPCL( text, band, pcl[0] ) ) { pcl[0]=10; return; }
- text = frmRFTool->edtPCLTS1->Text; if( !IsValidPCL( text, band, pcl[1] ) ) { pcl[1]=10; return; }
- text = frmRFTool->edtPCLTS2->Text; if( !IsValidPCL( text, band, pcl[2] ) ) { pcl[2]=10; return; }
- text = frmRFTool->edtPCLTS3->Text; if( !IsValidPCL( text, band, pcl[3] ) ) { pcl[3]=10; return; }
- text = frmRFTool->edtMultiSlotTxAFC->Text; if (!IsValidAFC(text, s_afc_dac)) { s_afc_dac = 4100; return; }
- text = frmRFTool->edtMultiSlotTxTA->Text; if( !IsValidTA( text, ta ) ) { ta = 0; return; }
- if( frmRFTool->gbMultiSlotTxBurstType->Visible )
- {
- //isEDGEsupport = true;
- if( frmRFTool->rbMultiSlotTxNBAll0->Checked ) pattern = NB_TX_ALL_ZEROS_WITHOUT_TSC;
- else if( frmRFTool->rbMultiSlotTxNBAll1->Checked ) pattern = NB_TX_ALL_ONES_WITHOUT_TSC;
- else if( frmRFTool->rbMultiSlotTxNB->Checked ) pattern = NB_TX_RANDOM_WITH_TSC;
- else if( frmRFTool->rbMultiSlotTxFixed->Checked ) pattern = NB_TX_FIXED_RANDOM_WITH_TSC;
- else if( frmRFTool->rbMultiSlotTxFixedAll0->Checked ) pattern = NB_TX_FIXED_ALL_ZEROS_WITH_TSC;
- else if( frmRFTool->rbMultiSlotTxFixedAlter->Checked ) pattern = NB_TX_FIXED_ALTER_BITS_WITH_TSC;
- else pattern = NB_TX_PATTERN_WITHOUT_TSC;
- if( frmRFTool->rbMultiSlotTxPattern->Checked )
- {
- text = frmRFTool->edtMultiSlotTxPattern->Text; if( !IsValidMultiSlotTxPattern( text, pattern_data ) ) { pattern_data = 0101010101010101; return; }
- }
- }
- // else
- // {
- // isEDGEsupport = false;
- // }
- m_eCurBand = band;
- CurrentPageLock();
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_bMultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = band;
- multi_slot_tx.req.arfcn = arfcn;
- multi_slot_tx.req.bsic = tsc;
- multi_slot_tx.req.timeSlotmask = TimeSlotMask;
- for (int i=0; i<4; i++)
- {
- multi_slot_tx.req.powerLev[i] = pcl[i];
- multi_slot_tx.req.cs[i] = cs[i];
- }
- multi_slot_tx.req.ta = ta;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.dacValue = s_afc_dac;
- multi_slot_tx.req.pattern = pattern;
- multi_slot_tx.req.pattern_data = pattern_data;
- m_RF_MULTI_SLOT_TX_Obj.ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- m_RF_MULTI_SLOT_TX_Obj.REQ_Start(multi_slot_tx);
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX progressing";
- }
- //---------------------------------------------------------------------------
- void TfrmEpskInterSlotRampSetting::ConfirmCallback_MultiSlotTX(void)
- {
- E_METAAPP_RESULT_T state = m_RF_MULTI_SLOT_TX_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX fail";
- Application->MessageBox( "Execution Failure : Multi slot TX", "FAILURE", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX timeout";
- Application->MessageBox( "Execution Timeout : Multi slot TX", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX stop";
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::edtArfcnCheck(
- 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 TfrmEpskInterSlotRampSetting::tclEpskInterRampChange(
- TObject *Sender)
- {
- if( ! frmMainSel->cbGSM850->Checked )
- {
- if (BANDSEL_GSM850 == (E_BANDSEL) tclEpskInterRamp->TabIndex)
- {
- tclEpskInterRamp->TabIndex = m_iLastTabIndex;
- Application->MessageBox( "Please check GSM 850 on main menu", "FAILURE", MB_OK );
- return;
- }
- }
- if( !CheckFields() )
- {
- tclEpskInterRamp->TabIndex = m_eCurBand;
- return;
- }
- m_eCurBand = (E_BANDSEL) tclEpskInterRamp->TabIndex;
- m_iLastTabIndex = tclEpskInterRamp->TabIndex;
- if( 1 == btnTXStart->Tag )
- {
- btnTXStopClick(this);
- }
- ReDrawFields();
- }
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- void __fastcall TfrmEpskInterSlotRampSetting::btnTXStopClick(
- TObject *Sender)
- {
- if( BTN_TAG_START == btnTXStart->Tag )
- {
- frmRFTool->Force_RF_Stop();
- frmRFTool->pctlToolSel->Enabled = true;
- frmRFTool->btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- CurrentPageReset();
- frmRFTool->CurrentPageReset();
- sbISR->Panels->Items[0]->Text = (AnsiString) " Multi slot TX stop";
- }
- }
- //---------------------------------------------------------------------------