form_RFTXIQBBTX.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:45k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- // form
- #ifndef _FORM_MAIN_H_
- #include "form_main.h"
- #endif
- #ifndef _FORM_RFTXIQBBTX_H_
- #include "form_RFTXIQBBTX.h"
- #endif
- // misc
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- #ifndef _MISC_H_
- #include "misc.h"
- #endif
- #ifndef _MAN_FDM_H_
- #include "man_fdm.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmTXIQBBTXSetting *frmTXIQBBTXSetting;
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // TX IQ
- static void CNF_TXIQ_ReadFromNVRAM( void )
- { frmTXIQBBTXSetting->TXIQ_UploadFromFlashDone();
- }
- //--------------------------------------------------------------------------
- static void CNF_TXIQ_WriteToNVRAM( void )
- { frmTXIQBBTXSetting->TXIQ_DownloadToFlashDone();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- static void ConfirmCallback_TX( void )
- { frmTXIQBBTXSetting->ConfirmCallback_TX();
- }
- //----------------------------------------------------------------------------
- static void ConfirmCallback_MultiSlotTX( void )
- {
- frmTXIQBBTXSetting->ConfirmCallback_MultiSlotTX();
- }
- //---------------------------------------------------------------------------
- __fastcall TfrmTXIQBBTXSetting::TfrmTXIQBBTXSetting(TComponent* Owner)
- : TForm(Owner)
- {
-
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Init( void )
- {
- m_bInit = true;
- }
- //===========================================================================
- void __fastcall TfrmTXIQBBTXSetting::FormCreate(TObject *Sender)
- {
- Init();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- // BbTxCfgVer
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- m_eBbTxCfgVer = m_pcRF_TXIQRUN_Obj->Query_BBTxCfgVer_Start(bb_chip);
- // RF ID
- m_uiFinalRfid = frmMainSel->Get_FinalRFID();
- if ((RF_ID_A60111A == m_uiFinalRfid) ||
- (RF_ID_AERO2E == m_uiFinalRfid) ||
- (RF_ID_MT6140A == m_uiFinalRfid) ||
- (RF_ID_MT6140B == m_uiFinalRfid) ||
- (RF_ID_MT6140C == m_uiFinalRfid) ||
- (RF_ID_MT6140D == m_uiFinalRfid)
- )
- {
- pnlHBPHeader->Visible = true;
- pnlHBP->Visible = true;
- }
- else
- {
- pnlHBPHeader->Visible = false;
- pnlHBP->Visible = false;
- }
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap();
- if( m_sFinalMSCAP.capability.EDGE_8PSK_TX )
- {
- lblTXModulation->Visible = true;
- cbTXModulation->Visible = true;
- }
- else
- {
- lblTXModulation->Visible = false;
- cbTXModulation->Visible = false;
- cbTXModulation->ItemIndex = MOD_GMSK_INDEX;
- }
- if( MOD_GMSK_INDEX == cbTXModulation->ItemIndex )
- {
- Display_TxGmskUi();
- }
- else
- {
- Display_TxEpskUi();
- }
- m_bMultiSlotTxExSupport = frmRFTool->Get_MultiSlotTxExSupport();
- }
- }
- //===========================================================================
- void TfrmTXIQBBTXSetting::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 TfrmTXIQBBTXSetting::CurrentPageReset( void )
- {
- btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- btnTXIQUploadFromFlash->Enabled = true;
- btnTXIQDownloadToFlash->Enabled = true;
- btnTXIQChangeDB->Enabled = true;
- btnTXIQLoadFromFile->Enabled = true;
- btnTXIQSaveToFile->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::CurrentPageLock( void )
- {
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- btnTXIQUploadFromFlash->Enabled = false;
- btnTXIQDownloadToFlash->Enabled = false;
- btnTXIQChangeDB->Enabled = false;
- btnTXIQLoadFromFile->Enabled = false;
- btnTXIQSaveToFile->Enabled = false;
- }
- //===========================================================================
- void TfrmTXIQBBTXSetting::RedrawBBTxParameters(void)
- {
- char str[256];
- edtTXIQBBTXCommonModeVoltage->Text = IntToStr ( m_sUiL1CalTxIq.BBTXParameters.bbtx_common_mode_voltage ) ;
- edtTXIQBBTXGain->Text = IntToStr ( m_sUiL1CalTxIq.BBTXParameters.bbtx_gain );
- edtTXIQBBTXCalrcsel->Text = IntToStr (m_sUiL1CalTxIq.BBTXParameters.bbtx_calrcsel);
- sprintf(str, "%.3f", m_sUiL1CalTxIq.BBTXParameters.apc_bat_low_voltage);
- edtTXIQAPCBatLowVoltage->Text = (AnsiString) str;
- sprintf(str, "%.3f", m_sUiL1CalTxIq.BBTXParameters.apc_bat_high_voltage);
- edtTXIQAPCBatHighVoltage->Text = (AnsiString) str;
- sprintf(str, "%.3f", m_sUiL1CalTxIq.BBTXParameters.apc_bat_low_temperature);
- edtTXIQAPCBatLowTemperature->Text = (AnsiString) str;
- sprintf(str, "%.3f", m_sUiL1CalTxIq.BBTXParameters.apc_bat_high_temperature);
- edtTXIQAPCBatHighTemperature->Text = (AnsiString) str;
-
- edtTXIQBBTXTrimI->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_trimI );
- edtTXIQBBTXTrimQ->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_trimQ );
- edtTXIQBBTXOffsetI->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetI );
- edtTXIQBBTXOffsetQ->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetQ );
- edtTXIQBBTXCalibratedFlag ->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_isCalibrated );
- if ((RF_ID_A60111A == m_uiFinalRfid) ||
- (RF_ID_AERO2E == m_uiFinalRfid) ||
- (RF_ID_MT6140A == m_uiFinalRfid) ||
- (RF_ID_MT6140B == m_uiFinalRfid) ||
- (RF_ID_MT6140C == m_uiFinalRfid) ||
- (RF_ID_MT6140D == m_uiFinalRfid)
- )
- {
- edtTXIQBBTXPhasesel->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_phsel );
- edtTXIQBBTXCommonModeVoltageHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_common_mode_voltage_h );
- edtTXIQBBTXGainHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_gain_h );
- edtTXIQBBTXCalrcselHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_calrcsel_h );
- edtTXIQBBTXTrimIHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_trimI_h );
- edtTXIQBBTXTrimQHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_trimQ_h );
- edtTXIQBBTXOffsetIHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetI_h );
- edtTXIQBBTXOffsetQHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetQ_h );
- edtTXIQBBTXPhaseselHigh->Text = IntToStr( m_sUiL1CalTxIq.BBTXParameters.bbtx_phsel_h );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Display_TxGmskUi( void )
- {
- lblTXCS->Visible = false;
- cbTXCS->Visible = false;
- lblTXTA->Visible = false;
- edtTXTA->Visible = false;
- Display_TXGmskBurstType();
-
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap( );
- Display_TxCS( m_sFinalMSCAP.capability, GMSK );
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Display_TxEpskUi( void )
- {
- lblTXCS->Visible = true;
- cbTXCS->Visible = true;
- lblTXTA->Visible = true;
- edtTXTA->Visible = true;
- Display_TXEpskBurstType();
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap( );
- Display_TxCS( m_sFinalMSCAP.capability, EPSK );
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Display_TXGmskBurstType( void )
- {
- int i;
- AnsiString BT_GMSK[] =
- {
- "NB (TSC)",
- "AB",
- "All 1"
- };
- cbTXBurstType->Items->Clear();
- for( i=0; i<sizeof(BT_GMSK)/sizeof(BT_GMSK[0]); i++)
- {
- cbTXBurstType->Items->Add(BT_GMSK[i]);
- }
- cbTXBurstType->ItemIndex = 0;
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Display_TxCS( RfMsCapabilityBits capability, E_MODULATION modulation )
- {
- AnsiString CS_GPRS[] =
- {
- "CS1",
- "CS2",
- "CS3",
- "CS4",
- "PRACH8",
- "PRACH11"
- };
- AnsiString CS_EGPRS_GMSK[] =
- {
- "CS1",
- "CS2",
- "CS3",
- "CS4",
- "PRACH8",
- "PRACH11",
- "MCS1",
- "MCS2",
- "MCS3",
- "MCS4"
- };
- AnsiString CS_EGPRS_EPSK[] =
- {
- "MCS5",
- "MCS6",
- "MCS7",
- "MCS8",
- "MCS9"
- };
- int i;
- cbTXCS->Clear();
- if( GMSK == modulation )
- {
- if( capability.EDGE_RX || capability.EDGE_8PSK_TX )
- {
- for( i=0; i<sizeof(CS_EGPRS_GMSK)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_EGPRS_GMSK[i]);
- }
- }
- else if( capability.GPRS )
- {
- for( i=0; i<sizeof(CS_GPRS)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_GPRS[i]);
- }
- }
- }
- else // EPSK
- {
- if( capability.EDGE_8PSK_TX )
- {
- for( i=0; i<sizeof(CS_EGPRS_EPSK)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_EGPRS_EPSK[i]);
- }
- }
- }
- cbTXCS->ItemIndex = 0;
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Display_TXEpskBurstType( void )
- {
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap( );
-
- if( m_sFinalMSCAP.capability.EDGE_8PSK_TX )
- {
- AnsiString BT_EPSK[] =
- {
- "NB (TSC)",
- "All 0",
- "All 1",
- "Pattern",
- "Fixed (TSC)",
- "Fixed All 0 (TSC)",
- "Fixed Alter Bits (TSC)"
- };
- cbTXBurstType->Items->Clear();
- for(int i=0; i<sizeof(BT_EPSK)/sizeof(BT_EPSK[0]); i++)
- {
- cbTXBurstType->Items->Add(BT_EPSK[i]);
- }
- cbTXBurstType->ItemIndex = 0;
- lblTXBurstType->Visible = true;
- cbTXBurstType->Visible = true;
- }
- else
- {
- lblTXBurstType->Visible = false;
- cbTXBurstType->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Get_BBTXChangeFlag(S_BBTXPARA_CHANGE_FLAG_T& flag)
- {
- flag.b_bbtx_common_mode_voltage = edtTXIQBBTXCommonModeVoltage->Visible;
- flag.b_bbtx_gain = edtTXIQBBTXGain->Visible;
- flag.b_bbtx_calrcsel = edtTXIQBBTXCalrcsel->Visible;
- flag.b_bbtx_trimI = edtTXIQBBTXTrimI->Visible;
- flag.b_bbtx_trimQ = edtTXIQBBTXTrimQ->Visible;
- flag.b_bbtx_offsetI = edtTXIQBBTXOffsetI->Visible;
- flag.b_bbtx_offsetQ = edtTXIQBBTXOffsetQ->Visible;
- flag.b_bbtx_isCalibrated = edtTXIQBBTXCalibratedFlag->Visible;
- flag.b_apc_bat_low_voltage = edtTXIQAPCBatLowVoltage->Visible;
- flag.b_apc_bat_high_voltage = edtTXIQAPCBatHighVoltage->Visible;
- flag.b_apc_bat_low_temperature = edtTXIQAPCBatLowTemperature->Visible;
- flag.b_apc_bat_high_temperature = edtTXIQAPCBatHighTemperature->Visible;
- flag.b_bbtx_common_mode_voltage_h = edtTXIQBBTXCommonModeVoltageHigh->Visible;
- flag.b_bbtx_gain_h = edtTXIQBBTXGainHigh->Visible;
- flag.b_bbtx_calrcsel_h = edtTXIQBBTXCalrcselHigh->Visible;
- flag.b_bbtx_trimI_h = edtTXIQBBTXTrimIHigh->Visible;
- flag.b_bbtx_trimQ_h = edtTXIQBBTXTrimQHigh->Visible;
- flag.b_bbtx_offsetI_h = edtTXIQBBTXOffsetIHigh->Visible;
- flag.b_bbtx_offsetQ_h = edtTXIQBBTXOffsetQHigh->Visible;
- flag.b_bbtx_phsel = edtTXIQBBTXPhasesel->Visible;
- flag.b_bbtx_phsel_h = edtTXIQBBTXPhaseselHigh->Visible;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::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))
- {
- edit->Text = IntToStr( Default_ARFCN[m_eCurBand] );
- ShowHintLabel( edit, hint[m_eCurBand] );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtPclCheck(TObject *Sender)
- {
- int i;
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 4~31 ",
- " value shall be 0~28 ",
- " value shall be 0~15 ",
- " value shall be 4~31 ",
- };
- text = edit->Text;
- if( text.AnsiCompare("") == 0 ) return;
- if( !IsValidPCL( text, m_eCurBand, data ) )
- {
- ShowHintLabel( edit, hint[m_eCurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtAfcDacCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~8191 ";
- text = edit->Text;
- if (!IsValidAFC(text, sdata))
- {
- ShowHintLabel( edit, hint );
- edit->Text = IntToStr( Default_AFC );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTACheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~63 ";
- text = edit->Text;
- if( !IsValidTA( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TA;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtPatternCheck(TObject *Sender)
- {
- unsigned short data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " binary format and length<=16 "
- };
- text = edit->Text;
- if( !IsValidMultiSlotTxPattern( text, data ) )
- { ShowHintLabel( edit, hint);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtBBTXCommonModeVoltageCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXCommonModeVoltage( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXCommonModeVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_common_mode_voltage = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_common_mode_voltage_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtBBTXGainCheck(TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXGain( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXGain );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_gain = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_gain_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtCTBBTXCalrcselCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXCalrcsel( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXCalrcsel );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_calrcsel = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_calrcsel_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTXIQBBTXTrimICheck(TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be -8~7 ";
- text = edit->Text;
- if( !IsValidTrimIQ( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TrimIQ;
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_trimI = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_trimI_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTXIQBBTXTrimQCheck(TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be -8~7 ";
- text = edit->Text;
- if( !IsValidTrimIQ( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TrimIQ;
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_trimQ = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_trimQ_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTXIQBBTXOffsetICheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][128] = {" value shall be -32~31 ", " value shall be -64~63 "};
- text = edit->Text;
- if (!IsValidOffsetIQ(m_eBbTxCfgVer, text, data))
- {
- if (m_eBbTxCfgVer < BBTXCFG_VER4)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetI = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetI_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTXIQBBTXOffsetQCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][128] = {" value shall be -32~31 ", " value shall be -64~63 "};
- text = edit->Text;
- if (!IsValidOffsetIQ(m_eBbTxCfgVer, text, data))
- {
- if (m_eBbTxCfgVer < BBTXCFG_VER4)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetQ = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_offsetQ_h = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtBBTXCalibratedFlagCheck(
- TObject *Sender)
- {
- unsigned char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value is not valid ";
- text = edit->Text;
- if( !IsValidBBTXCalibratedFlag( text, data ) )
- {
- edtTXIQBBTXTrimI->Enabled = false;
- edtTXIQBBTXTrimQ->Enabled = false;
- edtTXIQBBTXOffsetI->Enabled = false;
- edtTXIQBBTXOffsetQ->Enabled = false;
- ShowHintLabel( edit, hint );
- edit->Text = "0";
- edit->SetFocus();
- return;
- }
- edtTXIQBBTXTrimI->Enabled = true;
- edtTXIQBBTXTrimQ->Enabled = true;
- edtTXIQBBTXOffsetI->Enabled = true;
- edtTXIQBBTXOffsetQ->Enabled = true;
- m_sUiL1CalTxIq.BBTXParameters.bbtx_isCalibrated = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtAPCBatLowVoltageCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be 0 ~ 10 "
- };
- text = edit->Text;
- if( !IsValidAPCBatLowVoltage( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatLowVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sUiL1CalTxIq.BBTXParameters.apc_bat_low_voltage = d_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtAPCBatHighVoltageCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be 0 ~ 10 "
- };
- text = edit->Text;
- if( !IsValidAPCBatHighVoltage( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatHighVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sUiL1CalTxIq.BBTXParameters.apc_bat_high_voltage = d_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtAPCBatLowTemperatureCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -50 ~ 100 "
- };
- text = edit->Text;
- if( !IsValidAPCBatLowTemperature( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatLowTemperature );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sUiL1CalTxIq.BBTXParameters.apc_bat_low_temperature = d_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtAPCBatHighTemperatureCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -50 ~ 100 "
- };
- text = edit->Text;
- if( !IsValidAPCBatHighTemperature( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatHighTemperature );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sUiL1CalTxIq.BBTXParameters.apc_bat_high_temperature = d_data;
- }
- #if 0
- //============================================================================
- void TfrmTXIQBBTXSetting::SetBBTxParameterAccess( void )
- {
- // low band
- m_sBBTXParAccess.b_bbtx_common_mode_voltage = edtTXIQBBTXCommonModeVoltage->Visible;
- m_sBBTXParAccess.b_bbtx_gain = edtTXIQBBTXGain->Visible;
- m_sBBTXParAccess.b_bbtx_calrcsel = edtTXIQBBTXCalrcsel->Visible;
- m_sBBTXParAccess.b_bbtx_phsel = edtTXIQBBTXPhasesel->Visible;
- m_sBBTXParAccess.b_bbtx_trimI = edtTXIQBBTXTrimI->Visible;
- m_sBBTXParAccess.b_bbtx_trimQ = edtTXIQBBTXTrimQ->Visible;
- m_sBBTXParAccess.b_bbtx_offsetI = edtTXIQBBTXOffsetI->Visible;
- m_sBBTXParAccess.b_bbtx_offsetQ = edtTXIQBBTXOffsetQ->Visible;
- // high band
- m_sBBTXParAccess.b_bbtx_common_mode_voltage_h = edtTXIQBBTXCommonModeVoltageHigh->Visible;
- m_sBBTXParAccess.b_bbtx_gain_h = edtTXIQBBTXGainHigh->Visible;
- m_sBBTXParAccess.b_bbtx_calrcsel_h = edtTXIQBBTXCalrcselHigh->Visible;
- m_sBBTXParAccess.b_bbtx_phsel_h = edtTXIQBBTXPhaseselHigh->Visible;
- m_sBBTXParAccess.b_bbtx_trimI_h = edtTXIQBBTXTrimIHigh->Visible;
- m_sBBTXParAccess.b_bbtx_trimQ_h = edtTXIQBBTXTrimQHigh->Visible;
- m_sBBTXParAccess.b_bbtx_offsetI_h = edtTXIQBBTXOffsetIHigh->Visible;
- m_sBBTXParAccess.b_bbtx_offsetQ_h = edtTXIQBBTXOffsetQHigh->Visible;
- // common
- m_sBBTXParAccess.b_bbtx_isCalibrated = edtTXIQBBTXCalibratedFlag->Visible;
- m_sBBTXParAccess.b_apc_bat_low_voltage = edtTXIQAPCBatLowVoltage->Visible;
- m_sBBTXParAccess.b_apc_bat_high_voltage = edtTXIQAPCBatHighVoltage->Visible;
- m_sBBTXParAccess.b_apc_bat_low_temperature = edtTXIQAPCBatLowTemperature->Visible;
- m_sBBTXParAccess.b_apc_bat_high_temperature = edtTXIQAPCBatHighTemperature->Visible;
- }
- #endif
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::btnTXIQUploadFromFlashClick(
- TObject *Sender)
- {
- if (!NVRAMMan->Get_IsInit())
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if (!NVRAMMan->Get_IsInit())
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- m_pcRF_TXIQ_Obj->ConfirmCallback = ::CNF_TXIQ_ReadFromNVRAM;
- m_pcRF_TXIQ_Obj->REQ_Read_From_NVRAM_Start(m_uiFinalRfid, m_eBbTxCfgVer);
- CurrentPageLock();
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::TXIQ_UploadFromFlashDone( void )
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQ_Obj->Get_ConfirmState();
- char str[20];
- float fdata;
- switch( state )
- {
- case METAAPP_SUCCESS:
- {
- // if( m_bBBTxDownloadTrigger )
- // {
- // m_pcRF_TXIQ_Obj->Set_UiBBTXParameters(m_sUiL1CalTxIq);
- // m_pcRF_TXIQ_Obj->ConfirmCallback = ::CNF_TXIQ_WriteToNVRAM;
- // m_pcRF_TXIQ_Obj->REQ_Write_To_NVRAM_Start(m_uiFinalRfid);
- // }
- // else
- {
- S_UI_L1CAL_TXIQ* p_txiq = m_pcRF_TXIQ_Obj->Get_UiBBTXParameters();
- m_sUiL1CalTxIq = *p_txiq;
- RedrawBBTxParameters();
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Upload TXIQ setting from flash successful";
- }
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Upload TXIQ setting from flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Upload TXIQ setting form flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Upload TXIQ setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload TXIQ setting form flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Upload TXIQ setting from flash stop";
- }
- break;
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmTXIQBBTXSetting::btnTXIQDownloadToFlashClick(
- TObject *Sender)
- {
- if (!NVRAMMan->Get_IsInit())
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- S_BBTXPARA_CHANGE_FLAG_T flag;
- Get_BBTXChangeFlag(flag);
- m_pcRF_TXIQ_Obj->Set_BBTXChangeFlag(flag);
- m_pcRF_TXIQ_Obj->Set_UiBBTXParameters(m_eBbTxCfgVer, m_uiFinalRfid, m_sUiL1CalTxIq);
- m_pcRF_TXIQ_Obj->ConfirmCallback = ::CNF_TXIQ_WriteToNVRAM;
- m_pcRF_TXIQ_Obj->REQ_Write_To_NVRAM_Start(m_uiFinalRfid, m_eBbTxCfgVer);
- CurrentPageLock();
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::TXIQ_DownloadToFlashDone( void )
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQ_Obj->Get_ConfirmState();
- CurrentPageReset();
- switch( state )
- {
- case METAAPP_SUCCESS:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Download TXIQ setting to flash successful";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Download TXIQ setting to flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Download TXIQ setting to flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Download TXIQ setting to flash timeout";
- Application->MessageBox( "Execution Timeout : Download TXIQ setting to flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Download TXIQ setting to flash stop";
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " NVRAM_EF_L1_TXIQ_LID version is not support, please update META to latest version";
- Application->MessageBox("Execution Warning : NVRAM_EF_L1_TXIQ_LID version is not support, please update META to latest version", "WARNING", MB_OK);
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmTXIQBBTXSetting::btnTXIQChangeDBClick(TObject *Sender)
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::btnTXIQLoadFromFileClick(
- TObject *Sender)
- {
- char str[512];
- bool ok;
- float fdata;
- ok = dlgOpen->Execute();
- if( !ok )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load TXIQ setting from file fail";
- Application->MessageBox( "Execution Failure : Load TXIQ setting from file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, dlgOpen->FileName.c_str() );
- ok = m_pcRF_TXIQ_Obj->REQ_Read_From_File(str, m_uiFinalRfid, m_eBbTxCfgVer);
- if( ok )
- {
- S_UI_L1CAL_TXIQ* p_txiq = m_pcRF_TXIQ_Obj->Get_UiBBTXParameters();
- m_sUiL1CalTxIq = *p_txiq;
- RedrawBBTxParameters();
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load TXIQ setting from file successful";
- }
- else
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load TXIQ setting from file fail";
- Application->MessageBox( "Execution Failure : Load TXIQ setting from file", "FAILURE", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::btnTXIQSaveToFileClick(
- TObject *Sender)
- {
- char str[512];
- bool ok;
- ok = dlgSave->Execute();
- if( !ok )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save TXIQ setting to file fail";
- Application->MessageBox( "Execution Failure : Save TXIQ setting to file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, dlgSave->FileName.c_str() );
- S_BBTXPARA_CHANGE_FLAG_T flag;
- Get_BBTXChangeFlag(flag);
- m_pcRF_TXIQ_Obj->Set_BBTXChangeFlag(flag);
-
- m_pcRF_TXIQ_Obj->Set_UiBBTXParameters(m_eBbTxCfgVer, m_uiFinalRfid, m_sUiL1CalTxIq);
- ok = m_pcRF_TXIQ_Obj->REQ_Write_To_File(str, m_uiFinalRfid, m_eBbTxCfgVer);
- if (!ok)
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save TXIQ setting to file fail";
- Application->MessageBox( "Execution Failure : Save TXIQ setting to file", "FAILURE", MB_OK );
- }
- else
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save TXIQ setting to file successfully";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::Timer2Timer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::btnTXStartClick(TObject *Sender)
- {
- E_BANDSEL e_band;
- short arfcn;
- int tsc;
- int pcl;
- short s_afc_dac;
- APCTxPattern e_burst_type;
- signed char trim_i;
- signed char trim_q;
- signed char off_i;
- signed char off_q;
- AnsiString text;
- if (btnTXStart->Tag)
- {
- return;
- }
- e_band = (E_BANDSEL) cbxTXBand->ItemIndex;
- text = edtTXArfcn->Text; if( !IsValidARFCN( text, e_band, arfcn ) ) { edtArfcnCheck(edtTXArfcn); return; }
- text = edtTXPcl->Text; if( !IsValidPCL( text, e_band, pcl ) ) { edtPclCheck(edtTXPcl); return; }
- text = edtTXAfc->Text; if (!IsValidAFC(text, s_afc_dac)) { edtAfcDacCheck(edtTXAfc); return; }
- tsc = cbxTXTsc->ItemIndex;
- CurrentPageLock();
- if (MOD_GMSK_INDEX == cbTXModulation->ItemIndex)
- {
- e_burst_type = Get_GmskBurstType();
- S_RFTX rf_tx;
- rf_tx.e_bandsel = e_band;
- rf_tx.s_RfNbTxReq.arfcn = arfcn;
- rf_tx.s_RfNbTxReq.bsic = tsc;
- rf_tx.s_RfNbTxReq.power = pcl;
- rf_tx.s_RfNbTxReq.frames = -99;
- rf_tx.s_RfNbTxReq.dacValue = s_afc_dac;
- rf_tx.s_RfNbTxReq.burstTypeNB = e_burst_type;
- m_pcRF_TX_Obj->ConfirmCallback = ::ConfirmCallback_TX;
- m_pcRF_TX_Obj->REQ_Start(rf_tx);
- }
- else
- {
- int pcl_ms[4];
- CodingScheme e_cs_ms[4];
- //bool isEDGEsupport;
- unsigned short pattern_data;
- int ta;
- char TimeSlotMask = 0x01;
- e_cs_ms[0] = (CodingScheme) cbTXCS->ItemIndex + (int) CodingSchemeMCS5;
- e_cs_ms[1] = (CodingScheme) cbTXCS->ItemIndex + (int) CodingSchemeMCS5;
- e_cs_ms[2] = (CodingScheme) cbTXCS->ItemIndex + (int) CodingSchemeMCS5;
- e_cs_ms[3] = (CodingScheme) cbTXCS->ItemIndex + (int) CodingSchemeMCS5;
- text = edtTXPcl->Text; if( !IsValidPCL( text, e_band, pcl_ms[0] ) ) { edtPclCheck(edtTXPcl); return; }
- pcl_ms[1] = pcl_ms[0];
- pcl_ms[2] = pcl_ms[0];
- pcl_ms[3] = pcl_ms[0];
- text = edtTXTA->Text; if( !IsValidTA( text, ta ) ) { edtTACheck(edtTXTA); return; }
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap();
- //if( m_sFinalMSCAP.capability.EDGE_8PSK_TX )
- //{
- // isEDGEsupport = 1;
- //}
- //else
- //{
- // isEDGEsupport = 0;
- //}
- e_burst_type = Get_EpskBurstType();
- if (NB_TX_PATTERN_WITHOUT_TSC == e_burst_type)
- {
- text = edtTXPattern->Text; if( !IsValidMultiSlotTxPattern( text, pattern_data ) ) { edtPatternCheck(edtTXPattern); return; }
- }
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_bMultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = e_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_ms[i];
- multi_slot_tx.req.cs[i] = e_cs_ms[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 = e_burst_type;
- multi_slot_tx.req.pattern_data = pattern_data;
- m_pcRF_MULTI_SLOT_TX_Obj->ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- m_pcRF_MULTI_SLOT_TX_Obj->REQ_Start(multi_slot_tx);
- }
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX processing";
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::ConfirmCallback_TX( void )
- {
- E_METAAPP_RESULT_T state = m_pcRF_TX_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX fail";
- Application->MessageBox( "Execution Failure : Burst TX", "FAILURE", MB_OK );
- Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX timeout";
- Application->MessageBox( "Execution Timout : Burst TX", "TIMEOUT", MB_OK );
- Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::ConfirmCallback_MultiSlotTX( void )
- {
- E_METAAPP_RESULT_T state = m_pcRF_MULTI_SLOT_TX_Obj->Get_ConfirmState();
- switch( state )
- {
- case METAAPP_SUCCESS:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Burst TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Burst TX fail";
- Application->MessageBox( "Execution Failure : Burst TX", "FAILURE", MB_OK );
- Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Burst TX timeout";
- Application->MessageBox( "Execution Timeout : Burst TX", "TIMEOUT", MB_OK );
- Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Burst TX stop";
- }
- break;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmTXIQBBTXSetting::btnTXStopClick(TObject *Sender)
- {
- if( 1 == btnTXStart->Tag )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- Force_RF_Stop();
- CurrentPageReset();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Force_RF_Stop( void )
- {
- m_pcRF_TX_Obj->REQ_Stop();
- //m_pcRF_TXIQ_Obj->REQ_Stop();
- m_pcRF_MULTI_SLOT_TX_Obj->REQ_Stop();
- m_pcRF_STOP_Obj->REQ_Start();
- }
- //--------------------------------------------------------------------------
- APCTxPattern TfrmTXIQBBTXSetting::Get_GmskBurstType(void)
- {
- APCTxPattern e_bt;
- if (cbTXBurstType->Text.AnsiCompareIC("AB") == 0)
- {
- e_bt = AB_TX_RANDOM_WITH_SYNC_SEQ;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("All 1") == 0)
- {
- e_bt = NB_TX_ALL_ONES_WITHOUT_TSC;
- }
- else
- {
- e_bt = NB_TX_RANDOM_WITH_TSC;
- }
- return e_bt;
- }
- //--------------------------------------------------------------------------
- APCTxPattern TfrmTXIQBBTXSetting::Get_EpskBurstType(void)
- {
- APCTxPattern e_bt;
- if (cbTXBurstType->Text.AnsiCompareIC("All 0") == 0)
- {
- e_bt = NB_TX_ALL_ZEROS_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("All 1") == 0)
- {
- e_bt = NB_TX_ALL_ONES_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Pattern") == 0)
- {
- e_bt = NB_TX_PATTERN_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_RANDOM_WITH_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed All 0 (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_ALL_ZEROS_WITH_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed Alter Bits (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_ALTER_BITS_WITH_TSC;
- }
- else
- {
- e_bt = NB_TX_RANDOM_WITH_TSC;
- }
- return e_bt;
- }
- //============================================================================
- /////////////////////////// export information //////////////////////////////
- //============================================================================
- void TfrmTXIQBBTXSetting::Set_RF_TX_Obj( CRFTX* rf_tx_obj )
- { m_pcRF_TX_Obj = rf_tx_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Set_RF_TXIQ_Obj( CRFTXIQ *rf_txiq_obj )
- {
- m_pcRF_TXIQ_Obj = rf_txiq_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Set_RF_MULTI_SLOT_TX_Obj( CRFMULTISLOTTX *rf_multi_slot_tx_obj )
- {
- m_pcRF_MULTI_SLOT_TX_Obj = rf_multi_slot_tx_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXSetting::Set_RF_STOP_Obj( CRFSTOP* rf_stop_obj )
- { m_pcRF_STOP_Obj = rf_stop_obj;
- }
- void __fastcall TfrmTXIQBBTXSetting::cbTXModulationChange(TObject *Sender)
- {
- if( MOD_GMSK_INDEX == cbTXModulation->ItemIndex )
- {
- Display_TxGmskUi();
- }
- else
- {
- Display_TxEpskUi();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::cbxBandChange(TObject *Sender)
- {
- TEdit *edit = edtTXArfcn;
- short sdata;
- if (!frmMainSel->cbGSM850->Checked)
- {
- if (BANDSEL_GSM850 == (E_BANDSEL) ((TComboBox*)Sender)->ItemIndex )
- {
- ((TComboBox*)Sender)->ItemIndex = 0;
- Application->MessageBox( "Please check GSM 850 on main menu", "FAILURE", MB_OK );
- }
- }
- m_eCurBand = (E_BANDSEL) ((TComboBox*)Sender)->ItemIndex;
- edtArfcnCheck(edit);
- if( !IsValidARFCN(edit->Text, m_eCurBand, sdata) )
- {
- edit->Text = IntToStr( Default_ARFCN[m_eCurBand] );
- }
-
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::cbTXBurstTypeChange(TObject *Sender)
- {
- if( cbTXBurstType->Text.AnsiCompareIC("Pattern") == 0 )
- {
- lblTXPattern->Visible = true;
- edtTXPattern->Visible = true;
- }
- else
- {
- lblTXPattern->Visible = false;
- edtTXPattern->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXSetting::edtTXIQBBTXPhaseselCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][256] =
- {
- " value shall be -3 ~ 3 ",
- " value shall be -5 ~ 5 "
- };
- text = edit->Text;
- if (!IsValidBBTXPhasesel(m_eBbTxCfgVer, text, data))
- {
- if (m_eBbTxCfgVer <= BBTXCFG_VER4)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->Text = Default_TrimIQ;
- edit->SetFocus();
- return;
- }
- if( 0 == edit->Tag ) // low band
- {
- m_sUiL1CalTxIq.BBTXParameters.bbtx_phsel = data;
- }
- else
- { m_sUiL1CalTxIq.BBTXParameters.bbtx_phsel_h = data;
- }
- }