META_Factory.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:269k
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveADCCal( void )
- {
- if ( cbADC->Checked )
- {
- write_ADC_calibration( "MF_setup.txt", Application->ExeName, "yes" );
- }
- else
- {
- write_ADC_calibration( "MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayCVCal(void)
- {
- AnsiString as_CV_calibration = read_CV_calibration("MF_setup.txt", Application->ExeName);
- if (as_CV_calibration.AnsiCompareIC("yes") == 0)
- {
- m_cbCV->Checked = true;
- }
- else
- {
- m_cbCV->Checked = false;
- }
- if ((m_Cal.e_bb_chip != MT6205) &&
- (m_Cal.e_bb_chip != MT6205B) &&
- (m_Cal.e_bb_chip != MT6217) &&
- (m_Cal.e_bb_chip != MT6218) &&
- (m_Cal.e_bb_chip != MT6218B) &&
- (m_Cal.e_bb_chip != MT6219) &&
- (m_Cal.e_bb_chip != MT6225) &&
- (m_Cal.e_bb_chip != MT6226) &&
- (m_Cal.e_bb_chip != MT6226D) &&
- (m_Cal.e_bb_chip != MT6226M) &&
- (m_Cal.e_bb_chip != MT6227) &&
- (m_Cal.e_bb_chip != MT6227D) &&
- (m_Cal.e_bb_chip != MT6228) &&
- (m_Cal.e_bb_chip != MT6229) &&
- (m_Cal.e_bb_chip != MT6230) &&
- (m_Cal.e_bb_chip != MT6268T) &&
- (m_Cal.e_bb_chip != TK6516_MD)
- )
- {
- m_cbCV->Visible = true;
- }
- else
- {
- m_cbCV->Visible = false;
- m_cbCV->Checked = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveCVCal(void)
- {
- if (m_cbCV->Checked)
- {
- write_CV_calibration("MF_setup.txt", Application->ExeName, "yes");
- }
- else
- {
- write_CV_calibration("MF_setup.txt", Application->ExeName, "no");
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayWiFiTxDcOffsetCal( void )
- {
- AnsiString as_WiFiTxDcOffset_calibration = read_WiFiTxDcOffset_calibration("MF_setup.txt", Application->ExeName);
- if(as_WiFiTxDcOffset_calibration.AnsiCompareIC("yes") == 0)
- {
- cbWiFiTxDcOffset->Checked = true;
- }
- else
- {
- cbWiFiTxDcOffset->Checked = false;
- }
- WiFi_ChipCapability_S sWiFiCap = frmMainSel->Get_FinalWiFiCap();
- if (sWiFiCap.support_802_11b ||
- sWiFiCap.support_802_11a ||
- sWiFiCap.support_802_11g
- )
- {
- cbWiFiTxDcOffset->Visible = true;
- }
- else
- {
- cbWiFiTxDcOffset->Visible = false;
- cbWiFiTxDcOffset->Checked = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveWiFiTxDcOffsetCal(void)
- {
- if ( cbWiFiTxDcOffset->Checked )
- {
- write_WiFiTxDcOffset_calibration( "MF_setup.txt", Application->ExeName, "yes" );
- }
- else
- {
- write_WiFiTxDcOffset_calibration( "MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayWiFiTxPowerCal(void)
- {
- AnsiString as_WiFiTxPower_calibration = read_WiFiTxPower_calibration("MF_setup.txt", Application->ExeName);
- if(as_WiFiTxPower_calibration.AnsiCompareIC("yes") == 0)
- {
- cbWiFiTxPower->Checked = true;
- }
- else
- {
- cbWiFiTxPower->Checked = false;
- }
- WiFi_ChipCapability_S sWiFiCap = frmMainSel->Get_FinalWiFiCap();
- if (sWiFiCap.support_802_11b ||
- sWiFiCap.support_802_11a ||
- sWiFiCap.support_802_11g
- )
- {
- cbWiFiTxPower->Visible = true;
- }
- else
- {
- cbWiFiTxPower->Visible = false;
- cbWiFiTxPower->Checked = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveWiFiTxPowerCal(void)
- {
- if ( cbWiFiTxPower->Checked )
- {
- write_WiFiTxPower_calibration( "MF_setup.txt", Application->ExeName, "yes" );
- }
- else
- {
- write_WiFiTxPower_calibration( "MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayBTCrystalCAPIDCal(void)
- {
- AnsiString as_BTCrystalCAPIDCal = read_BTCrystalCAPID_calibration("MF_setup.txt", Application->ExeName);
- if (as_BTCrystalCAPIDCal.AnsiCompareIC("yes") == 0)
- {
- m_cbBTCapID->Checked = true;
- }
- else
- {
- m_cbBTCapID->Checked = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveBTCrystalCAPIDCal(void)
- {
- if (m_cbBTCapID->Checked)
- {
- write_BTCrystalCAPID_calibration("MF_setup.txt", Application->ExeName, "yes");
- }
- else
- {
- write_BTCrystalCAPID_calibration("MF_setup.txt", Application->ExeName, "no");
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayPAType(void)
- {
- AnsiString as_PAType = read_PAType("MF_setup.txt", Application->ExeName);
- if(as_PAType.AnsiCompareIC("RFMD3140") == 0)
- {
- cbPAType->ItemIndex = RFMD_3140;
- }
- else if(as_PAType.AnsiCompareIC("RFMD3159") == 0)
- {
- cbPAType->ItemIndex = RFMD_3159;
- }
- else if(as_PAType.AnsiCompareIC("RenesasPF08155B") == 0)
- {
- cbPAType->ItemIndex = RENESAS_PF08155B;
- }
- //else if(as_PAType.AnsiCompareIC("RenesasPF09016B") == 0)
- //{
- // cbPAType->ItemIndex = RENESAS_PF09016B;
- //}
- else if(as_PAType.AnsiCompareIC("Skyworks77328") == 0)
- {
- cbPAType->ItemIndex = SKY_77328;
- }
- else if(as_PAType.AnsiCompareIC("Skyworks77506") == 0)
- {
- cbPAType->ItemIndex = SKY_77506;
- }
- else if(as_PAType.AnsiCompareIC("Skyworks77316") == 0)
- {
- cbPAType->ItemIndex = SKY_77316;
- }
- else if (as_PAType.AnsiCompareIC("Skyworks77340") == 0)
- {
- cbPAType->ItemIndex = SKY_77340;
- }
- else if (as_PAType.AnsiCompareIC("Axiom502") == 0)
- {
- cbPAType->ItemIndex = AXIOM_AX502;
- }
- else if (as_PAType.AnsiCompareIC("Triquint TQM6M5001") == 0)
- {
- cbPAType->ItemIndex = TRIQUINT_TQM6M5001;
- }
- else
- {
- cbPAType->ItemIndex = RFMD_3140;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SavePAType(void)
- {
- switch (cbPAType->ItemIndex)
- {
- case RFMD_3140:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "RFMD3140");
- }
- break;
- case RFMD_3159:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "RFMD3159");
- }
- break;
- case SKY_77328:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Skyworks77328");
- }
- break;
- case SKY_77506:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Skyworks77506");
- }
- break;
- case SKY_77316:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Skyworks77316");
- }
- break;
- case SKY_77340:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Skyworks77340");
- }
- break;
-
- case RENESAS_PF08155B:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "RenesasPF08155B");
- }
- break;
- //case RENESAS_PF09016B:
- // write_PAType( "MF_setup.txt", Application->ExeName, "RenesasPF09016B" );
- // break;
- case AXIOM_AX502:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Axiom502");
- }
- break;
- case TRIQUINT_TQM6M5001:
- {
- write_PAType("MF_setup.txt", Application->ExeName, "Triquint TQM6M5001");
- }
- default:
- {
- }
- break;
- }
- }
- #if 0
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayPABiasType(void)
- {
- AnsiString as_PABiasType = read_PABiasType("MF_setup.txt", Application->ExeName);
- // if(as_PABiasType.AnsiCompareIC("Fixed") == 0)
- {
- // m_rbFixedPaBias->Checked = true;
- }
- // else
- // {
- // m_rbDynPaBias->Checked = true;
- // }
- // if (RFMD_3159 == cbPAType->ItemIndex)
- // {
- // m_gbPaBias->Visible = true;
- // }
- // else
- {
- // m_gbPaBias->Visible = false;
- }
- }
- #endif
- #if 0
- //---------------------------------------------------------------------------
- void TfrmFatcory::SavePABiasType(void)
- {
- if (m_rbFixedPaBias->Checked)
- {
- write_PABiasType("MF_setup.txt", Application->ExeName, "Fixed");
- }
- else
- {
- write_PABiasType("MF_setup.txt", Application->ExeName, "Dynamic");
- }
- }
- #endif
- //====================================================================================
- void TfrmFatcory::DisplayTXPCLType(void)
- {
- // GMSK
- AnsiString as_GMSK_TX_PCL_type = read_GMSK_TX_PCL_type("MF_setup.txt", Application->ExeName);
- if (as_GMSK_TX_PCL_type.AnsiCompareIC("full pcl") == 0)
- {
- m_rbGMSKFullPCL->Checked = true;
- if (SKY_77316 == cbPAType->ItemIndex ||
- SKY_77328 == cbPAType->ItemIndex ||
- SKY_77506 == cbPAType->ItemIndex
- )
- {
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = false;
- }
- else
- {
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_rb6DAC->Enabled = false;
- }
- }
- else // not GMSK TX PCL
- {
- if (SKY_77316 == cbPAType->ItemIndex ||
- SKY_77328 == cbPAType->ItemIndex ||
- SKY_77506 == cbPAType->ItemIndex
- )
- {
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK2PCL->Checked = true;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = false;
- }
- else
- {
- m_rbGMSK3PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_rb6DAC->Enabled = false;
- }
- }
- if (SKY_77340 == cbPAType->ItemIndex)
- {
- m_rbGMSK3PCL->Enabled = false;
- }
- // EPSK
- AnsiString as_EPSK_TX_PCL_type = read_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName);
- if (as_EPSK_TX_PCL_type.AnsiCompareIC("full pcl") == 0)
- {
- m_rbEPSKFullPCL->Checked = true;
- if (SKY_77316 == cbPAType->ItemIndex)
- {
- m_gbEPSKTxPcl->Visible = true;
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK2PCL->Enabled = true;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- }
- else if ((RFMD_3159 == cbPAType->ItemIndex) ||
- (SKY_77340 == cbPAType->ItemIndex)
- )
- {
- m_gbEPSKTxPcl->Visible = true;
- if (m_Cal.ui_rf_id != RF_ID_A60111A)
- {
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = true;
- }
- else
- {
- m_rbEPSK1PCL->Enabled = true;
- m_rbEPSK4PCL->Enabled = false;
- }
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- }
- else
- {
- m_gbEPSKTxPcl->Visible = false;
- }
- }
- else // not full EPSK TX PCL
- {
- if (SKY_77316 == cbPAType->ItemIndex)
- {
- m_gbEPSKTxPcl->Visible = true;
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK2PCL->Enabled = true;
- m_rbEPSK2PCL->Checked = true;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- }
- else if ((RFMD_3159 == cbPAType->ItemIndex) ||
- (SKY_77340 == cbPAType->ItemIndex)
- )
- {
- m_gbEPSKTxPcl->Visible = true;
- if (m_Cal.ui_rf_id != RF_ID_A60111A)
- {
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = true;
- m_rbEPSK4PCL->Checked = true;
- }
- else
- {
- m_rbEPSK1PCL->Enabled = true;
- m_rbEPSK1PCL->Checked = true;
- m_rbEPSK4PCL->Enabled = false;
- }
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- }
- else
- {
- m_gbEPSKTxPcl->Visible = false;
- }
- }
- }
- //--------------------------------------------------------------------------
- void TfrmFatcory::SaveTXPCLType(void)
- {
- // GMSK
- if (m_rbGMSK2PCL->Checked)
- {
- write_GMSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "2 pcl");
- }
- else if (m_rbGMSK3PCL->Checked)
- {
- write_GMSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "3 pcl");
- }
- else
- {
- write_GMSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "full pcl");
- }
- // EPSK
- if (m_rbEPSK1PCL->Checked)
- {
- write_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "1 pcl");
- }
- else if (m_rbEPSK2PCL->Checked)
- {
- write_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "2 pcl");
- }
- else if (m_rbEPSK3PCL->Checked)
- {
- write_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "3 pcl");
- }
- else if (m_rbEPSK4PCL->Checked)
- {
- write_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "4 pcl");
- }
- else
- {
- write_EPSK_TX_PCL_type("MF_setup.txt", Application->ExeName, "full pcl");
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayApcModulation(void)
- {
- // GMSK
- AnsiString as_APC_GMSK_Mod = read_APC_GMSK_Modulation("MF_setup.txt", Application->ExeName);
- if (as_APC_GMSK_Mod.AnsiCompareIC("yes") == 0)
- {
- m_cbGMSK->Checked = true;
- }
- else
- {
- m_cbGMSK->Checked = false;
- }
- // EPSK
- AnsiString as_APC_EPSK_Mod = read_APC_EPSK_Modulation("MF_setup.txt", Application->ExeName);
- if (as_APC_EPSK_Mod.AnsiCompareIC("yes") == 0)
- {
- m_cbEPSK->Checked = true;
- }
- else
- {
- m_cbEPSK->Checked = false;
- }
- if ((RFMD_3159 == cbPAType->ItemIndex) ||
- (SKY_77316 == cbPAType->ItemIndex) ||
- (SKY_77340 == cbPAType->ItemIndex)
- )
- {
- m_cbEPSK->Visible = true;
- m_gbEPSKTxPcl->Visible = true;
- }
- else
- {
- m_cbEPSK->Visible = false;
- m_gbEPSKTxPcl->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveApcModulation(void)
- {
- if (m_cbGMSK->Checked)
- {
- write_APC_GMSK_Modulation("MF_setup.txt", Application->ExeName, "yes");
- }
- else
- {
- write_APC_EPSK_Modulation("MF_setup.txt", Application->ExeName, "no");
- }
- if (m_cbEPSK->Checked)
- {
- write_APC_EPSK_Modulation("MF_setup.txt", Application->ExeName, "yes");
- }
- else
- {
- write_APC_EPSK_Modulation("MF_setup.txt", Application->ExeName, "no");
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayRFCalibrationEquipment(void)
- {
- AnsiString as_RF_calibration_equipment = read_RF_calibration_equipment("MF_setup.txt", Application->ExeName);
- m_Rct.device_type = m_rct_ctrl.RCT_StringToDeviceType( as_RF_calibration_equipment );
- switch( m_Rct.device_type )
- {
- case AGILENT_8960:
- {
- rbAgilent8960->Checked = true;
- }
- break;
- case CMU_200:
- default:
- {
- rbCMU200->Checked = true;
- }
- break;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveRFCalibrationEquipment( void )
- {
- if ( rbAgilent8960->Checked )
- {
- write_RF_calibration_equipment( "MF_setup.txt", Application->ExeName, "agilent 8960" );
- }
- else
- {
- write_RF_calibration_equipment( "MF_setup.txt", Application->ExeName, "cmu 200" );
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayWiFiCalibrationEquipment(void)
- {
- AnsiString as_WiFi_calibration_equipment = read_WiFi_calibration_equipment("MF_setup.txt", Application->ExeName);
- if (as_WiFi_calibration_equipment.AnsiCompareIC("N4010A") == 0)
- {
- rbAgilentN4010A->Checked = true;
- }
- else
- {
- rbLitePointIQV->Checked = true;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveWiFiCalibrationEquipment(void)
- {
- if (rbAgilentN4010A->Checked)
- {
- write_WiFi_calibration_equipment("MF_setup.txt", Application->ExeName, "N4010A");
- }
- else
- {
- write_WiFi_calibration_equipment("MF_setup.txt", Application->ExeName, "IQView" );
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::DisplayBTCalibrationEquipment(void)
- {
- AnsiString as_WiFi_calibration_equipment = read_BT_calibration_equipment("MF_setup.txt", Application->ExeName);
- if (as_WiFi_calibration_equipment.AnsiCompareIC("CMU 200") == 0)
- {
- m_cbBTTester->ItemIndex = BT_DEVICE_CMU_200;
- }
- else
- {
- m_cbBTTester->ItemIndex = BT_DEVICE_CBT;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveBTCalibrationEquipment(void)
- {
- switch (m_cbBTTester->ItemIndex)
- {
- case BT_DEVICE_CMU_200:
- {
- write_BT_calibration_equipment("MF_setup.txt", Application->ExeName, "CMU 200");
- }
- break;
- case BT_DEVICE_CBT:
- {
- write_BT_calibration_equipment("MF_setup.txt", Application->ExeName, "CBT");
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayPowerSupplyType(void)
- {
- AnsiString as_Power_Supply_Type = read_Power_Supply_Type("MF_setup.txt", Application->ExeName);
- m_Dcs.device_type = m_dcs_ctrl.DCS_StringToDeviceType( as_Power_Supply_Type );
- m_cbPowerSupply->ItemIndex = m_Dcs.device_type;
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SavePowerSupplyType(void)
- {
- switch (m_cbPowerSupply->ItemIndex)
- {
- case AGILENT_661x:
- {
- write_Power_Supply_Type("MF_setup.txt", Application->ExeName, AGILENT_661x_STR);
- }
- break;
- case AGILENT_663x2:
- {
- write_Power_Supply_Type("MF_setup.txt", Application->ExeName, AGILENT_663x2_STR);
- }
- break;
- case AGILENT_E3631A:
- {
- write_Power_Supply_Type("MF_setup.txt", Application->ExeName, AGILENT_E3631A_STR);
- }
- break;
- case KEITHLEY_2306:
- {
- write_Power_Supply_Type("MF_setup.txt", Application->ExeName, KEITHLEY_2306_STR);
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayReadBarcodeFromEnter( void )
- {
- as_Read_barcode_from_enter = read_Read_barcode_from_enter("MF_setup.txt", Application->ExeName);
- if(as_Read_barcode_from_enter.AnsiCompareIC("file") == 0)
- {
- cbReadBarcodeFromEnter->ItemIndex = BARCODE_READ_FROM_FILE_INDEX;
- as_Barcode = read_Barcode("MF_setup.txt", Application->ExeName);
- edtBarcode->Text = as_Barcode;
- DisplayBarcodeAfterIncreasement( cbBarcodeIncreasementEnter->ItemIndex );
- }
- else if(as_Read_barcode_from_enter.AnsiCompareIC("flash") == 0)
- {
- cbReadBarcodeFromEnter->ItemIndex = BARCODE_READ_FROM_FLASH_INDEX;
- ReadBarcodeFromNVRAM();
- }
- else
- {
- cbReadBarcodeFromEnter->ItemIndex = BARCODE_READ_FROM_NONE_INDEX;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveReadBarcodeFromEnter( void )
- {
- if ( cbReadBarcodeFromEnter->ItemIndex == BARCODE_READ_FROM_FILE_INDEX )
- {
- write_Read_barcode_from_enter( "MF_setup.txt", Application->ExeName, "file" );
- }
- else if ( cbReadBarcodeFromEnter->ItemIndex == BARCODE_READ_FROM_FLASH_INDEX )
- {
- write_Read_barcode_from_enter( "MF_setup.txt", Application->ExeName, "flash" );
- }
- else
- {
- write_Read_barcode_from_enter( "MF_setup.txt", Application->ExeName, "none" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayAutoStartCalibrationEnter( void )
- {
- as_Auto_start_calibration_enter = read_Auto_start_calibration_enter("MF_setup.txt", Application->ExeName);
- if(as_Auto_start_calibration_enter.AnsiCompareIC("yes") == 0)
- {
- cbAutoStartCalibrationEnter->Checked = true;
- }
- else
- {
- cbAutoStartCalibrationEnter->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveAutoStartCalibrationEnter( void )
- {
- if ( cbAutoStartCalibrationEnter->Checked == true )
- {
- write_Auto_start_calibration_enter("MF_setup.txt", Application->ExeName, "yes" );
- }
- else
- {
- write_Auto_start_calibration_enter("MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayBarcodeIncreasementEnter( void )
- {
- int temp_Barcode;
- as_Barcode_increasement_enter = read_Barcode_increasement_enter("MF_setup.txt", Application->ExeName);
- if (as_Barcode_increasement_enter.ToInt() <= 9)
- {
- cbBarcodeIncreasementEnter->ItemIndex = as_Barcode_increasement_enter.ToInt();
- //if( cbReadBarcodeFromEnter->ItemIndex != BARCODE_READ_FROM_FLASH_INDEX )
- //{
- // DisplayBarcodeAfterIncreasement( cbBarcodeIncreasementEnter->ItemIndex );
- //}
- }
- else
- {
- cbBarcodeIncreasementEnter->ItemIndex = 1; // set to increasement 1
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveBarcodeIncreasementEnter( void )
- {
- write_Barcode_increasement_enter( "MF_setup.txt", Application->ExeName, IntToStr((cbBarcodeIncreasementEnter->ItemIndex)) );
- }
- //====================================================================================
- void TfrmFatcory::DisplayBarcodeIncreasementExit( void )
- {
- as_Barcode_increasement_exit = read_Barcode_increasement_exit("MF_setup.txt", Application->ExeName);
- if (as_Barcode_increasement_exit.ToInt() <= 9)
- {
- cbBarcodeIncreasementExit->ItemIndex = as_Barcode_increasement_exit.ToInt();
- }
- else
- {
- cbBarcodeIncreasementExit->ItemIndex = 1; // set to increasement 1
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveBarcodeIncreasementExit( void )
- {
- write_Barcode_increasement_exit( "MF_setup.txt", Application->ExeName, IntToStr((cbBarcodeIncreasementExit->ItemIndex)) );
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToNVRAMSuccess( void )
- {
- as_Save_barcode_to_NVRAM_success = read_Save_barcode_to_NVRAM_success("MF_setup.txt", Application->ExeName);
- if (as_Save_barcode_to_NVRAM_success.AnsiCompareIC("yes") == 0)
- {
- cbSaveBarcodeToNVRAMSuccess->Checked = true;
- }
- else
- {
- cbSaveBarcodeToNVRAMSuccess->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToNVRAMSuccess( void )
- {
- if( cbSaveBarcodeToNVRAMSuccess->Checked == true )
- {
- write_Save_barcode_to_NVRAM_success( "MF_setup.txt", Application->ExeName, (AnsiString) "yes" );
- }
- else
- {
- write_Save_barcode_to_NVRAM_success( "MF_setup.txt", Application->ExeName, (AnsiString) "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToFileSuccess( void )
- {
- as_Save_barcode_to_file_success = read_Save_barcode_to_file_success("MF_setup.txt", Application->ExeName);
- if (as_Save_barcode_to_file_success.AnsiCompareIC("yes") == 0)
- {
- cbSaveBarcodeToFileSuccess->Checked = true;
- }
- else
- {
- cbSaveBarcodeToFileSuccess->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToFileSuccess( void )
- {
- if( cbSaveBarcodeToFileSuccess->Checked == true )
- {
- write_Save_barcode_to_file_success( "MF_setup.txt", Application->ExeName, (AnsiString) "yes" );
- }
- else
- {
- write_Save_barcode_to_file_success( "MF_setup.txt", Application->ExeName, (AnsiString) "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayBarcodeIncreasementSuccess( void )
- {
- as_Barcode_increasement_success = read_Barcode_increasement_success("MF_setup.txt", Application->ExeName);
- if (as_Barcode_increasement_success.ToInt() <= 9)
- {
- cbBarcodeIncreasementSuccess->ItemIndex = as_Barcode_increasement_success.ToInt();
- }
- else
- {
- cbBarcodeIncreasementSuccess->ItemIndex = 1; // set to increasement 1
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveBarcodeIncreasementSuccess( void )
- {
- write_Barcode_increasement_success( "MF_setup.txt", Application->ExeName, IntToStr((cbBarcodeIncreasementSuccess->ItemIndex)) );
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToNVRAMFail( void )
- {
- as_Save_barcode_to_NVRAM_fail = read_Save_barcode_to_NVRAM_fail("MF_setup.txt", Application->ExeName);
- if (as_Save_barcode_to_NVRAM_fail.AnsiCompareIC("yes") == 0)
- {
- cbSaveBarcodeToNVRAMFail->Checked = true;
- }
- else
- {
- cbSaveBarcodeToNVRAMFail->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToNVRAMFail( void )
- {
- if( cbSaveBarcodeToNVRAMFail->Checked == true )
- {
- write_Save_barcode_to_NVRAM_fail( "MF_setup.txt", Application->ExeName, (AnsiString) "yes" );
- }
- else
- {
- write_Save_barcode_to_NVRAM_fail( "MF_setup.txt", Application->ExeName, (AnsiString) "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToFileFail( void )
- {
- as_Save_barcode_to_file_fail = read_Save_barcode_to_file_fail("MF_setup.txt", Application->ExeName);
- if (as_Save_barcode_to_file_fail.AnsiCompareIC("yes") == 0)
- {
- cbSaveBarcodeToFileFail->Checked = true;
- }
- else
- {
- cbSaveBarcodeToFileFail->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToFileFail( void )
- {
- if( cbSaveBarcodeToFileFail->Checked == true )
- {
- write_Save_barcode_to_file_fail( "MF_setup.txt", Application->ExeName, (AnsiString) "yes" );
- }
- else
- {
- write_Save_barcode_to_file_fail( "MF_setup.txt", Application->ExeName, (AnsiString) "no" );
- }
- }
- //---------------------------------------------------------------------------------------
- void TfrmFatcory::SaveBarcodeToFile( void )
- {
- write_Barcode( "MF_setup.txt", Application->ExeName, edtBarcode->Text );
- }
- //====================================================================================
- void TfrmFatcory::DisplayBarcodeIncreasementFail( void )
- {
- as_Barcode_increasement_fail = read_Barcode_increasement_fail("MF_setup.txt", Application->ExeName);
- if (as_Barcode_increasement_fail.ToInt() <= 9)
- {
- cbBarcodeIncreasementFail->ItemIndex = as_Barcode_increasement_fail.ToInt();
- }
- else
- {
- cbBarcodeIncreasementFail->ItemIndex = 1; // set to increasement 1
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveBarcodeIncreasementFail( void )
- {
- write_Barcode_increasement_fail( "MF_setup.txt", Application->ExeName, IntToStr((cbBarcodeIncreasementFail->ItemIndex)) );
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToNVRAMExit( void )
- {
- as_Save_barcode_to_NVRAM_exit = read_Save_barcode_to_NVRAM_exit("MF_setup.txt", Application->ExeName);
- if(as_Save_barcode_to_NVRAM_exit.AnsiCompare("yes") == 0)
- {
- cbSaveBarcodeToNVRAMExit->Checked = true;
- }
- else
- {
- cbSaveBarcodeToNVRAMExit->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToNVRAMExit( void )
- {
- if ( cbSaveBarcodeToNVRAMExit->Checked == true )
- {
- write_Save_barcode_to_NVRAM_exit( "MF_setup.txt", Application->ExeName, "yes" );
- WriteBarcodeToNVRAMAfterIncreasement( cbBarcodeIncreasementExit->ItemIndex );
- }
- else
- {
- write_Save_barcode_to_NVRAM_exit( "MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplaySaveBarcodeToFileExit( void )
- {
- as_Save_barcode_to_file_exit = read_Save_barcode_to_file_exit("MF_setup.txt", Application->ExeName);
- if(as_Save_barcode_to_file_exit.AnsiCompare("yes") == 0)
- {
- cbSaveBarcodeToFileExit->Checked = true;
- }
- else
- {
- cbSaveBarcodeToFileExit->Checked = false;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::SaveSaveBarcodeToFileExit( void )
- {
- if ( cbSaveBarcodeToFileExit->Checked == true )
- {
- write_Save_barcode_to_file_exit( "MF_setup.txt", Application->ExeName, "yes" );
- SaveBarcodeAfterIncreasement( cbBarcodeIncreasementExit->ItemIndex );
- }
- else
- {
- write_Save_barcode_to_file_exit( "MF_setup.txt", Application->ExeName, "no" );
- }
- }
- //====================================================================================
- void TfrmFatcory::DisplayTerminateMETAExit ( void )
- {
- as_Terminate_META_exit = read_Terminate_META_exit("MF_setup.txt", Application->ExeName);
- if(as_Terminate_META_exit.AnsiCompareIC("yes") == 0)
- {
- cbTerminateMETAExit->Checked = true;
- }
- else
- {
- cbTerminateMETAExit->Checked = false;
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::SaveTerminateMETAExit( void )
- {
- write_Terminate_META_exit( "MF_setup.txt", Application->ExeName, as_Terminate_META_exit );
- }
- //====================================================================================
- void TfrmFatcory::DisplayTurnOffPowerSupplyFail ( void )
- {
- as_Turn_off_power_supply_fail = read_TurnOffPowerSupplyFail("MF_setup.txt", Application->ExeName);
- if(as_Turn_off_power_supply_fail.AnsiCompareIC("yes") == 0)
- {
- cbTurnOffPowerSupplyFail->Checked = true;
- }
- else if(as_Terminate_META_fail.AnsiCompareIC("no") == 0)
- {
- cbTurnOffPowerSupplyFail->Checked = false;
- }
- else
- {
- cbTurnOffPowerSupplyFail->Checked = false;
- as_Turn_off_power_supply_fail = (AnsiString) "no";
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::SaveTurnOffPowerSupplyFail ( void )
- {
- write_TurnOffPowerSupplyFail( "MF_setup.txt", Application->ExeName, as_Turn_off_power_supply_fail );
- }
- //====================================================================================
- void TfrmFatcory::DisplayTerminateMETAFail ( void )
- {
- as_Terminate_META_fail = read_TerminateMETAFail("MF_setup.txt", Application->ExeName);
- if(as_Terminate_META_fail.AnsiCompareIC("yes") == 0)
- {
- cbTerminateMETAFail->Checked = true;
- }
- else if(as_Terminate_META_fail.AnsiCompareIC("no") == 0)
- {
- cbTerminateMETAFail->Checked = false;
- }
- else
- {
- cbTerminateMETAFail->Checked = false;
- as_Terminate_META_fail = (AnsiString) "no";
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::SaveTerminateMETAFail ( void )
- {
- write_TerminateMETAFail( "MF_setup.txt", Application->ExeName, as_Terminate_META_fail );
- }
- //====================================================================================
- void TfrmFatcory::DisplayTurnOffPowerSupplySuccess( void )
- {
- as_Turn_off_power_supply_success = read_TurnOffPowerSupplySuccess("MF_setup.txt", Application->ExeName);
- if(as_Turn_off_power_supply_success.AnsiCompareIC("yes") == 0)
- {
- cbTurnOffPowerSupplySuccess->Checked = true;
- }
- else if(as_Terminate_META_success.AnsiCompareIC("no") == 0)
- {
- cbTurnOffPowerSupplySuccess->Checked = false;
- }
- else
- {
- cbTurnOffPowerSupplySuccess->Checked = false;
- as_Turn_off_power_supply_success = (AnsiString) "no";
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::SaveTurnOffPowerSupplySuccess ( void )
- {
- write_TurnOffPowerSupplySuccess( "MF_setup.txt", Application->ExeName, as_Turn_off_power_supply_success );
- }
- //====================================================================================
- void TfrmFatcory::DisplayTerminateMETASuccess ( void )
- {
- as_Terminate_META_success = read_TerminateMETASuccess("MF_setup.txt", Application->ExeName);
- if(as_Terminate_META_success.AnsiCompareIC("yes") == 0)
- {
- cbTerminateMETASuccess->Checked = true;
- }
- else if(as_Terminate_META_success.AnsiCompareIC("no") == 0)
- {
- cbTerminateMETASuccess->Checked = false;
- }
- else
- {
- cbTerminateMETAFail->Checked = false;
- as_Terminate_META_success = (AnsiString) "no";
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::SaveTerminateMETASuccess ( void )
- {
- write_TerminateMETASuccess( "MF_setup.txt", Application->ExeName, as_Terminate_META_success );
- }
- //===============================================================================
- AnsiString TfrmFatcory::readPowerSupplyGPIBAddr(void)
- {
- AnsiString GPIBAddr;
- GPIBAddr = m_dcs_ctrl.DCS_ReadGPIBAddress(&m_Dcs);
- return GPIBAddr;
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TfrmFatcory::savePowerSupplyGPIBAddr(void)
- {
- switch (m_cbPowerSupply->ItemIndex)
- {
- case AGILENT_661x:
- {
- write_661x_GPIB_Address("MF_setup.txt", Application->ExeName, m_Dcs.ADD);
- }
- break;
- case AGILENT_663x2:
- {
- write_663x2_GPIB_Address("MF_setup.txt", Application->ExeName, m_Dcs.ADD);
- }
- break;
- case AGILENT_E3631A:
- {
- write_E3631A_GPIB_Address("MF_setup.txt", Application->ExeName, m_Dcs.ADD);
- }
- break;
- case KEITHLEY_2306:
- {
- write_Keithley2306_GPIB_Address("MF_setup.txt", Application->ExeName, m_Dcs.ADD);
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //==============================================================================
- void TfrmFatcory::AllocateDynamicMemory(void)
- {
- if (NULL == st_Log)
- {
- st_Log = new TStringList();
- }
- // PM
- if (NULL == MF_rf_agc_ptr)
- {
- MF_rf_agc_ptr = new CRFAGC();
- }
- if (NULL == MF_rf_pm_cnf)
- {
- MF_rf_pm_cnf = new RfPm_Cnf;
- }
- if (NULL == MF_rf_pm_req)
- {
- MF_rf_pm_req = new RfPm_Req;
- }
- // IP2
- if (NULL == MF_rf_pm_ptr)
- {
- MF_rf_pm_ptr = new CRFPM();
- }
- // AFC
- if (NULL == MF_rf_afc_ptr)
- {
- MF_rf_afc_ptr = new CRFAFC();
- }
- if (NULL == MF_rf_afc_req)
- {
- MF_rf_afc_req = new RfAfc_Req;
- }
- // crystal AFC
- if (NULL == MF_crystal_afc_ptr)
- {
- MF_crystal_afc_ptr = new CCRYSTALAFC();
- }
- if (NULL == MF_bb_reg_ptr)
- {
- MF_bb_reg_ptr = new CBBREG();
- }
- // APC
- if (NULL == MF_rf_apc_ptr)
- {
- MF_rf_apc_ptr = new CRFAPC();
- }
- if (NULL == MF_rf_apc_8psk_ptr)
- {
- MF_rf_apc_8psk_ptr = new CRFAPC8PSK();
- }
- if (NULL == MF_rf_tx_level_req)
- {
- MF_rf_tx_level_req = new RfNbtx_Req;
- }
- // TX IQ
- if (NULL == MF_rf_txiq_ptr)
- {
- MF_rf_txiq_ptr = new CRFTXIQ();
- }
- // BT cap id
- if (NULL == m_Cal.s_cal_obj.pc_BT_INFO6601_Obj)
- {
- m_Cal.s_cal_obj.pc_BT_INFO6601_Obj = new CBTINFO6601();
- }
- if (NULL == m_Cal.s_cal_obj.pc_BT_INFO6611_Obj)
- {
- m_Cal.s_cal_obj.pc_BT_INFO6611_Obj = new CBTINFO6611();
- }
- // ADC
- if (NULL == MF_BB_ADC_Req)
- {
- MF_BB_ADC_Req = new ADCMeaData_Req;
- }
- if (NULL == BBCnf_ADC)
- {
- BBCnf_ADC = new ADCMeaData_Cnf;
- }
- if (NULL == MF_BB_ADC_ptr)
- {
- MF_BB_ADC_ptr = new CBBADC();
- }
- if (NULL == m_Cal.s_cal_obj.pc_WIFI_APC_Obj)
- {
- m_Cal.s_cal_obj.pc_WIFI_APC_Obj = new CWIFIAPC();
- }
- if (NULL == m_Cal.s_cal_obj.pc_WIFI_ALC_Obj)
- {
- m_Cal.s_cal_obj.pc_WIFI_ALC_Obj = new CWIFIALC();
- }
- if (NULL == m_Cal.s_cal_obj.pc_WIFI_TXDC_Obj)
- {
- m_Cal.s_cal_obj.pc_WIFI_TXDC_Obj = new CWIFITXDC();
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::DeallocateDynamicMemory(void)
- {
- if (META_factory_cfg)
- {
- delete META_factory_cfg;
- META_factory_cfg = NULL;
- }
- if (st_Log)
- {
- delete st_Log;
- st_Log = NULL;
- }
- // AFC
- if (MF_rf_afc_ptr)
- {
- delete MF_rf_afc_ptr;
- MF_rf_afc_ptr = NULL;
- }
- if (MF_rf_afc_req)
- {
- delete MF_rf_afc_req;
- MF_rf_afc_req = NULL;
- }
- if (MF_rf_afc_cnf)
- {
- delete MF_rf_afc_cnf;
- MF_rf_afc_cnf = NULL;
- }
- // crystal AFC
- if (MF_crystal_afc_ptr)
- {
- delete MF_crystal_afc_ptr;
- MF_crystal_afc_ptr = NULL;
- }
- if (MF_bb_reg_ptr)
- {
- delete MF_bb_reg_ptr;
- MF_bb_reg_ptr = NULL;
- }
- // AGC
- if (MF_rf_agc_ptr)
- {
- delete MF_rf_agc_ptr;
- MF_rf_agc_ptr = NULL;
- }
- if (MF_rf_pm_req)
- {
- delete MF_rf_pm_req;
- MF_rf_pm_req = NULL;
- }
- if (MF_rf_pm_cnf)
- {
- delete MF_rf_pm_cnf;
- MF_rf_pm_cnf = NULL;
- }
- // IP2
- if (MF_rf_pm_ptr)
- {
- delete MF_rf_pm_ptr;
- MF_rf_pm_ptr = NULL;
- }
- // TX IQ
- if (MF_rf_txiq_ptr)
- {
- delete MF_rf_txiq_ptr;
- MF_rf_txiq_ptr = NULL;
- }
- // APC
- if (MF_rf_apc_ptr)
- {
- delete MF_rf_apc_ptr;
- MF_rf_apc_ptr = NULL;
- }
- if (MF_rf_apc_8psk_ptr)
- {
- delete MF_rf_apc_8psk_ptr;
- MF_rf_apc_8psk_ptr = NULL;
- }
- if (MF_rf_tx_level_req)
- {
- delete MF_rf_tx_level_req;
- MF_rf_tx_level_req = NULL;
- }
- // BT CAP ID
- if (m_Cal.s_cal_obj.pc_BT_INFO6601_Obj)
- {
- delete m_Cal.s_cal_obj.pc_BT_INFO6601_Obj;
- m_Cal.s_cal_obj.pc_BT_INFO6601_Obj = NULL;
- }
- if (m_Cal.s_cal_obj.pc_BT_INFO6611_Obj)
- {
- delete m_Cal.s_cal_obj.pc_BT_INFO6611_Obj;
- m_Cal.s_cal_obj.pc_BT_INFO6611_Obj = NULL;
- }
- // ADC
- if (MF_BB_ADC_Req)
- {
- delete MF_BB_ADC_Req;
- MF_BB_ADC_Req = NULL;
- }
- if (BBCnf_ADC)
- {
- delete BBCnf_ADC;
- BBCnf_ADC = NULL;
- }
- if (MF_BB_ADC_ptr)
- {
- delete MF_BB_ADC_ptr;
- MF_BB_ADC_ptr = NULL;
- }
- if (MF_BB_ADC_Req)
- {
- delete MF_BB_ADC_Req;
- MF_BB_ADC_Req = NULL;
- }
- if (BBCnf_ADC)
- {
- delete BBCnf_ADC;
- BBCnf_ADC = NULL;
- }
- // WiFi
- if (m_Cal.s_cal_obj.pc_WIFI_APC_Obj)
- {
- delete m_Cal.s_cal_obj.pc_WIFI_APC_Obj;
- m_Cal.s_cal_obj.pc_WIFI_APC_Obj = NULL;
- }
- if (m_Cal.s_cal_obj.pc_WIFI_ALC_Obj)
- {
- delete m_Cal.s_cal_obj.pc_WIFI_ALC_Obj;
- m_Cal.s_cal_obj.pc_WIFI_ALC_Obj = NULL;
- }
- if (m_Cal.s_cal_obj.pc_WIFI_TXDC_Obj)
- {
- delete m_Cal.s_cal_obj.pc_WIFI_TXDC_Obj;
- m_Cal.s_cal_obj.pc_WIFI_TXDC_Obj = NULL;
- }
- }
- //------------------------------------------------------------------------------
- void TfrmFatcory::TerminateFactoryThread( void )
- {
- if( pt_calibration != NULL && is_calibration_start )
- {
- pt_calibration->Terminate();
- is_calibration_start = false;
- pt_calibration = NULL;
- }
- if(pt_boot != NULL)
- {
- pt_boot->Terminate();
- pt_boot = NULL;
- }
- }
- //==============================================================================
- void __fastcall TfrmFatcory::IMEICheck(TObject *Sender)
- {
- int i;
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " IMEI digit length shall be less or equal 14 ";
- text = edit->Text;
- if( !IsValidIMEI( text) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::IMEILengthCheck(TObject *Sender,
- WORD &Key, TShiftState Shift)
- {
- // if((edtIMEI->Text).Length() == MAX_IMEI_DIGIT_LEN)
- // {
- // check_sum = IMEI_DOWNLOAD_Object.REQ_NVRAM_Calcualte_IMEI_Spare((edtIMEI->Text).c_str());
- // lblCheckSum->Caption = IntToStr(check_sum);
- // }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbTerminateMETAExitClick(
- TObject *Sender)
- {
- if ( cbTerminateMETAExit->Checked )
- {
- as_Terminate_META_exit = (AnsiString) "yes";
- }
- else
- {
- as_Terminate_META_exit = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbTerminateMETAFailClick(
- TObject *Sender)
- {
- if ( cbTerminateMETAFail->Checked )
- {
- as_Terminate_META_fail = (AnsiString) "yes";
- }
- else
- {
- as_Terminate_META_fail = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbTurnOffPowerSupplyFailClick(
- TObject *Sender)
- {
- if ( cbTurnOffPowerSupplyFail->Checked )
- {
- as_Turn_off_power_supply_fail = (AnsiString) "yes";
- }
- else
- {
- as_Turn_off_power_supply_fail = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbTurnOffPowerSupplySuccessClick(
- TObject *Sender)
- {
- if ( cbTurnOffPowerSupplySuccess->Checked )
- {
- as_Turn_off_power_supply_success = (AnsiString) "yes";
- }
- else
- {
- as_Turn_off_power_supply_success = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbTerminateMETASuccessClick(
- TObject *Sender)
- {
- if ( cbTerminateMETASuccess->Checked )
- {
- as_Terminate_META_success = (AnsiString) "yes";
- }
- else
- {
- as_Terminate_META_success = (AnsiString) "no";
- }
- }
- //==============================================================================
- void TfrmFatcory::DisplayBarcodeAfterIncreasement( int Increasement )
- {
- AnsiString temp_as_Barcode;
- temp_as_Barcode = AnsiStringAdd( edtBarcode->Text , Increasement );
- edtBarcode->Text = temp_as_Barcode;
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SaveBarcodeAfterIncreasement( int Increasement )
- {
- AnsiString as_temp_Barcode;
- as_temp_Barcode = AnsiStringAdd( edtBarcode->Text , Increasement );
- edtBarcode->Text = as_temp_Barcode;
- write_Barcode( "MF_setup.txt", Application->ExeName, as_temp_Barcode );
- }
- //==============================================================================
- void __fastcall TfrmFatcory::cbSaveBarcodeToFileSuccessClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileSuccess->Checked )
- {
- as_Save_barcode_to_file_success = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_file_success = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbSaveBarcodeToNVRAMSuccessClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileSuccess->Checked )
- {
- as_Save_barcode_to_NVRAM_success = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_NVRAM_success = (AnsiString) "no";
- }
- }
- //==============================================================================
- void TfrmFatcory::ReadBarcodeFromNVRAM( void )
- {
- BARCODE_Object.ConfirmCallback = ::CNF_ReadFromNVRAM;
- BARCODE_Object.REQ_Read_From_NVRAM();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::UploadFromFlashDone(void)
- {
- E_METAAPP_RESULT_T state = BARCODE_Object.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sBarcode = BARCODE_Object.Get_Barcode();
- Barcode_ptr = m_sBarcode.c_Barcode;
- as_Barcode = (AnsiString) Barcode_ptr;
- edtBarcode->Text = as_Barcode;
- DisplayBarcodeAfterIncreasement( cbBarcodeIncreasementEnter->ItemIndex );
- }
- break;
- case METAAPP_FAIL:
- { Application->MessageBox( "Execution Failure : Upload barcode form flash", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- { Application->MessageBox( "Execution Timeout : Upload barcode form flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::WriteBarcodeToNVRAMAfterIncreasement( int increasement )
- {
- //strcpy( BARCODE_Object.Barcode, (AnsiStringAdd( edtBarcode->Text, increasement)).c_str() );
- S_BARCODE barcode;
- strcpy( barcode.c_Barcode, (AnsiStringAdd( edtBarcode->Text, increasement)).c_str() );
- BARCODE_Object.Set_Barcode( barcode );
- BARCODE_Object.ConfirmCallback = ::CNF_WriteToNVRAM;
- BARCODE_Object.REQ_Write_To_NVRAM();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::WriteBarcodeToNVRAM( void )
- {
- //strcpy( BARCODE_Object.Barcode, (edtBarcode->Text).c_str() );
- S_BARCODE barcode;
- strcpy( barcode.c_Barcode, (edtBarcode->Text).c_str() );
- BARCODE_Object.Set_Barcode( barcode );
- BARCODE_Object.ConfirmCallback = ::CNF_WriteToNVRAM;
- BARCODE_Object.REQ_Write_To_NVRAM();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::DownloadToFlashDone( void )
- {
- E_METAAPP_RESULT_T state = BARCODE_Object.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- }
- break;
- case METAAPP_FAIL:
- {
- Application->MessageBox( "Execution Failure : Download barcode to flash", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- Application->MessageBox( "Execution Timeout : Download barcode to flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- Application->MessageBox("Execution Warning : NVRAM_EF_BARCODE_NUM_LID version is not support, please update META to latest version", "WARNING", MB_OK);
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //==============================================================================
- void TfrmFatcory::SaveFactoryUISetting( void )
- {
- SaveAFCType();
- SaveCrystalCapId();
- // SaveCapIdCal();
- SaveTxAfcOffsetCal();
- SaveResetRfTester();
- SaveIP2Cal();
- SaveAFCCal();
- SaveRxPathLossCal();
- SaveTxIqCal();
- SaveTxPclCal();
- SaveADCCal();
- SaveCVCal();
- SaveWiFiTxDcOffsetCal();
- SaveWiFiTxPowerCal();
- SaveBTCrystalCAPIDCal();
- SaveTXPCLType();
- SavePAType();
- //SavePABiasType();
- SaveApcModulation();
- SaveRFCalibrationEquipment();
- SaveWiFiCalibrationEquipment();
- SaveBTCalibrationEquipment();
- SavePowerSupplyType();
- SaveReadBarcodeFromEnter();
- SaveBarcodeIncreasementEnter();
- SaveAutoStartCalibrationEnter();
- SaveSaveBarcodeToNVRAMExit();
- SaveSaveBarcodeToFileExit();
- SaveBarcodeIncreasementExit();
- SaveSaveBarcodeToNVRAMSuccess();
- SaveSaveBarcodeToFileSuccess();
- SaveBarcodeIncreasementSuccess();
- SaveSaveBarcodeToNVRAMFail();
- SaveSaveBarcodeToFileFail();
- SaveBarcodeIncreasementFail();
- //SaveBarcodeSaveTo();
- SaveTerminateMETAExit();
- SaveTerminateMETAFail();
- SaveTurnOffPowerSupplyFail();
- SaveTerminateMETASuccess();
- SaveTurnOffPowerSupplySuccess();
- }
- //=============================================================================
- void TfrmFatcory::Reconnect_Button_Click( void )
- {
- IsReconnectByFactory = true;
- frmMainSel->ReconnectButtonClick();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnReconnectClick(TObject *Sender)
- {
- Reconnect_Button_Click();
- }
- //==============================================================================
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbSaveBarcodeToNVRAMFailClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileFail->Checked )
- {
- as_Save_barcode_to_NVRAM_fail = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_NVRAM_fail = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbSaveBarcodeToFileFailClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileFail->Checked )
- {
- as_Save_barcode_to_file_fail = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_file_fail = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbAutoStartCalibrationEnterClick(
- TObject *Sender)
- {
- if( cbAutoStartCalibrationEnter->Checked )
- {
- as_Auto_start_calibration_enter = (AnsiString) "yes";
- }
- else
- {
- as_Auto_start_calibration_enter = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbSaveBarcodeToNVRAMExitClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileExit->Checked )
- {
- as_Save_barcode_to_NVRAM_exit = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_NVRAM_exit = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbSaveBarcodeToFileExitClick(
- TObject *Sender)
- {
- if( cbSaveBarcodeToFileExit->Checked )
- {
- as_Save_barcode_to_file_exit = (AnsiString) "yes";
- }
- else
- {
- as_Save_barcode_to_file_exit = (AnsiString) "no";
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::ReconnectWithTargetSuccess( void )
- {
- if( cbAutoStartCalibrationEnter->Checked )
- {
- Calibration_Button_Click();
- }
- }
- //------------------------------------------------------------------------------
- void __fastcall TfrmFatcory::FormCreate(TObject *Sender)
- {
- hForm_MF = this->Handle;
- MF_ctrl.hPostMsgDestHandle = this->Handle;
- hForm_PostMsgTarget = this->Handle;
- WindowProc = SubClassWndProc;
- b_OpenNVRAMdatabase = false;
- b_OpenCfgFile = false;
- b_SetupLogFile = false;
- b_OpenIniFile = false;
- m_Cal.b_CalResultPath = false;
- st_Log = NULL;
- MF_rf_agc_ptr = NULL;
- MF_rf_pm_cnf = NULL;
- MF_rf_pm_req = NULL;
- MF_rf_pm_ptr = NULL;
- MF_rf_afc_ptr = NULL;
- // MF_rf_SetAfcDacValue = NULL;
- MF_rf_afc_req = NULL;
- MF_crystal_afc_ptr = NULL;
- MF_bb_reg_ptr = NULL;
- MF_rf_apc_ptr = NULL;
- MF_rf_tx_level_req = NULL;
- MF_rf_txiq_ptr = NULL;
- MF_BB_ADC_Req = NULL;
- BBCnf_ADC = NULL;
- MF_BB_ADC_ptr = NULL;
-
- AllocateDynamicMemory();
- MF_state = eInit;
- MF_ctrl.hCOM = hCOM;
- MF_state = eInit;
- // read_BARCODE("MF_setup.txt", Application->ExeName);
- // EditStartID->Text = as_BARCODE;
- // DisableAllCalTimer();
- // equipment control
- i_NORMAL_VOLTAGE = read_NORMAL_VOLTAGE( "MF_setup.txt", Application->ExeName);
- i_CURRENT_LIMIT = read_CURRENT_LIMIT( "MF_setup.txt", Application->ExeName);
- i_OFF_VOLTAGE = read_OFF_VOLTAGE("MF_setup.txt", Application->ExeName);
- //LoadAge1960DllFunctions();
- //LoadVisa32DllFunctions();
- // as_Power_Supply_GPIB_addr = readAgilentPowerSupplyGPIBAddr();
- //InitAgilentPowerSupply_SetNormalVoltage_CloseAgilentPowerSupply();
-
- Init();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::StartButtonClickExecute(TObject *Sender)
- {
- Calibration_Button_Click();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::actReconnectButtonExecute(
- TObject *Sender)
- {
- Reconnect_Button_Click();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miSetupcalibrationdataresultfilepathClick(
- TObject *Sender)
- {
- frmCalPath->Top = 232;
- frmCalPath->Left = 48;
- frmCalPath->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miEditRXpathlossCFGParameterClick(
- TObject *Sender)
- {
- frmCFGRxPathLoss->Top = 4;
- frmCFGRxPathLoss->Left = 80;
- frmCFGRxPathLoss->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miTCVCXOAFCCFGParameterClick(
- TObject *Sender)
- {
- frmCFGAfc->Top = 168;
- frmCFGAfc->Left = 213;
- frmCFGAfc->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miCrystalAFCCFGParameterClick(
- TObject *Sender)
- {
- frmCFGCrystalAfc->Top = 168;
- frmCFGCrystalAfc->Left = 213;
- frmCFGCrystalAfc->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miTXPCLCFGParameterClick(
- TObject *Sender)
- {
- frmCFGTxPcl->Top = 27;
- frmCFGTxPcl->Left = 128;
- frmCFGTxPcl->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miADCCFGParameterClick(TObject *Sender)
- {
- frmCFGAdc->Top = 168;
- frmCFGAdc->Left = 45;
- frmCFGAdc->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::miCommonCFGParameterClick(
- TObject *Sender)
- {
- frmCFGCommon->Top = 4;
- frmCFGCommon->Left = 133;
- frmCFGCommon->Show();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::bb_StopClick(TObject *Sender)
- {
- if ( BUTTON_TAG_STOP == bb_Start->Tag )
- {
- DisableAllCalTimer();
- if ( pt_calibration != NULL && is_calibration_start)
- {
- pt_calibration->Terminate();
- is_calibration_start = false;
- pt_calibration = NULL;
- }
- write_log();
- clear_log();
- bb_Start->Tag = BUTTON_TAG_START;
- bb_Start->Enabled = true;
- bb_Start->Caption = "Start (F6)";
- CRFSTOP RF_STOP_Obj;
- RF_STOP_Obj.REQ_Start();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::ToggleHideExecute(TObject *Sender)
- {
- if( g_bHideEnable )
- {
- g_bHideEnable = false;
- }
- else
- {
- g_bHideEnable = true;
- }
- ApplyHideProperty();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::ApplyHideProperty(void)
- {
- gbTxGslot->Visible = !g_bHideEnable;
-
- #if 0
- if( g_bHideEnable )
- {
- // gbCrystalOption->Visible = false;
- // m_cbTrxOffset->Visible = false;
- // m_cbTrxOffset->Checked = false;
- //cbTxPhaseError->Visible = false;
- //cbTxPhaseError->Checked = false;
- //cbADC->Top = 100;
- //rbRenesasPF08155B->Visible = false;
- // rbRenesasPF09016B->Visible = false;
- //rbSkyworks77316->Visible = false;
- //miPhaseErrorCFGParameter->Visible = false;
- }
- else
- {
- //cbADC->Top = 123;
- // gbCrystalOption->Visible = true;
- // m_cbTrxOffset->Visible = true;
- //rbRenesasPF08155B->Visible = true;
- // rbRenesasPF09016B->Visible = true;
- //rbSkyworks77316->Visible = true;
- //cbTxPhaseError->Visible = true;
- //miPhaseErrorCFGParameter->Visible = true;
- }
- #endif
- }
- //==============================================================================
- TYPE_META_FACTORY_STATE TfrmFatcory::Get_MFState(void)
- {
- TYPE_META_FACTORY_STATE state;
- if( cbIP2->Checked )
- {
- state = eIP2;
- }
- else if( cbAFC->Checked )
- {
- state = eAFC;
- }
- else if( cbRxPathLoss->Checked )
- {
- state = eRF_PathLoss;
- }
- else if( cbTxIq->Checked )
- {
- state = eTX_DcOffset;
- }
- else if( cbTxPcl->Checked )
- {
- state = eTX_PCL;
- }
-
- return state;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbRFMD3140Click(TObject *Sender)
- {
- if( m_rbGMSK2PCL->Checked )
- m_rbGMSK3PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbRenesasPF08155BClick(TObject *Sender)
- {
- if( m_rbGMSK2PCL->Checked )
- m_rbGMSK3PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbSkyworks77316Click(TObject *Sender)
- {
- if( m_rbGMSK3PCL->Checked )
- m_rbGMSK2PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK3PCL->Enabled = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbSkyworks77328Click(TObject *Sender)
- {
- if( m_rbGMSK3PCL->Checked )
- m_rbGMSK2PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK3PCL->Enabled = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbRenesasPF09016BClick(TObject *Sender)
- {
- if( m_rbGMSK2PCL->Checked )
- m_rbGMSK3PCL->Checked = true;
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbAgilent663x2Click(TObject *Sender)
- {
- m_Dcs.device_type = AGILENT_663x2;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbAgilent661xClick(TObject *Sender)
- {
- m_Dcs.device_type = AGILENT_661x;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbAgilentE3631AClick(TObject *Sender)
- {
- m_Dcs.device_type = AGILENT_E3631A;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbAgilent8960Click(TObject *Sender)
- {
- m_Rct.device_type = AGILENT_8960;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbCMU200Click(TObject *Sender)
- {
- m_Rct.device_type = CMU_200;
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::WriteIP2RxAmCalModeToNormal(void)
- {
- MF_rf_pm_ptr->ConfirmCallback = ::CNF_ReadIP2FromNVRAM;
- MF_rf_pm_ptr->REQ_Read_IP2Reg_From_NVRAM_Start(m_Cal.ui_rf_id);
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::CNF_ReadIP2FromNVRAM(void)
- {
- if (MF_rf_pm_ptr->Get_ConfirmState() == METAAPP_SUCCESS)
- {
- MF_rf_pm_ptr->Get_uc_mt6139_coef();
- MF_rf_pm_ptr->Set_uc_mt6139_coef_rxamcalmode( RXAMCALMODE_MT6139C_NORMAL );
- MF_rf_pm_ptr->ConfirmCallback = ::CNF_WriteIP2ToNVRAM;
- MF_rf_pm_ptr->REQ_Write_IP2Reg_To_NVRAM_Start(m_Cal.ui_rf_id);
- }
- else
- {
- Application->MessageBox( "Execution Failure : Upload IP2 setting form flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::CNF_WriteIP2ToNVRAM( void )
- {
- if( MF_rf_pm_ptr->Get_ConfirmState() != METAAPP_SUCCESS )
- {
- Application->MessageBox( "Execution Failure : Download IP2 setting to flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- }
- }
- //===========================================================================
- ///////////////////////////// Query ////////////////////////////
- //===========================================================================
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_QueryRFID_Fail(TObject *Sender)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_QueryRFID_TerminateSuccess(TObject *Sender)
- {
- }
- //-----------------------------------------------------------------------------
- void TfrmFatcory::QueryRfId( void )
- {
- t_rf_id.hPostMsgDestHandle = this->Handle;
- t_rf_id.ne_onTermSuccess = on_QueryRFID_TerminateSuccess;
- pt_rfid = new T_RFID( true, &t_rf_id);
- if(pt_rfid != NULL)
- {
- pt_rfid->FreeOnTerminate = true;
- pt_rfid->OnTerminate = on_QueryRFID_Fail;
- pt_rfid->Priority = tpHighest;
- pt_rfid->Resume();
- }
- }
- //-----------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_QueryTwoApcDcOffset_Fail(TObject *Sender)
- {
- QueryRfId();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_QueryTwoApcDcOffset_TerminateSuccess(TObject *Sender)
- {
- QueryRfId();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::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();
- }
- }
- //===========================================================================
- ///////////////////////// Global information ////////////////////////////
- //===========================================================================
- void TfrmFatcory::Init(void)
- {
- m_bInit = true;
- // b_TADOSupport = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnNVRAMDBClick(TObject *Sender)
- {
- miOpenfdmfileClick( this );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnConfigurationClick(TObject *Sender)
- {
- miOpenConfigFileClick( Sender );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnLoggingClick(TObject *Sender)
- {
- miSetupLoggingFileClick( Sender );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnResultClick(TObject *Sender)
- {
- miSetupresultfileClick( Sender );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnCalInitClick(TObject *Sender)
- {
- miOpenInitialFileClick( Sender );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::btnCalResultPathClick(TObject *Sender)
- {
- miSetupcalibrationdataresultfilepathClick( Sender );
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbKeithley2306Click(TObject *Sender)
- {
- m_Dcs.device_type = KEITHLEY_2306;
- }
- //===========================================================================
- /////////////////////// Calibration Parameter ///////////////////////////
- //===========================================================================
- void TfrmFatcory::SetRctParameter(void)
- {
- // device type
- if( rbAgilent8960->Checked )
- {
- m_Rct.device_type = AGILENT_8960;
- m_Rct.as_RCT = "Agilent 8960";
- }
- else
- {
- m_Rct.device_type = CMU_200;
- m_Rct.as_RCT = "CMU 200";
- }
- //m_Rct.cmu = cmu;
- // CMU
- if( rbCrystal->Checked && cbAFC->Checked )
- {
- m_Rct.cmu.bSigEnable = true;
- }
- else
- {
- m_Rct.cmu.bSigEnable = false;
- }
- // reset RCT
- m_Rct.bReset = cbResetRfTester->Checked;
- }
- //-------------------------------------------------------------------------
- void TfrmFatcory::SetBttParameter(void)
- {
- // device type
- m_sBtt.e_device_type = (E_BT_DEVICE_TYPE)m_cbBTTester->ItemIndex;
- switch (m_sBtt.e_device_type)
- {
- case BT_DEVICE_CMU_200:
- {
- m_sBtt.as_BTT = "CMU 200";
- }
- break;
- case BT_DEVICE_CBT:
- {
- m_sBtt.as_BTT = "CBT";
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //-------------------------------------------------------------------------
- void TfrmFatcory::SetWftParameter( void )
- {
- // device type
- if( rbLitePointIQV->Checked )
- {
- m_Wft.device_type = IQVIEW;
- }
- else
- {
- m_Wft.device_type = N4010A;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SetDcsParameter(void)
- {
- AnsiString as_Power_Supply_GPIB_addr;
- m_Dcs.device_type = m_cbPowerSupply->ItemIndex;
- // GPIB address
- if (as_Power_Supply_GPIB_addr.AnsiCompare("") == 0)
- {
- switch (m_cbPowerSupply->ItemIndex)
- {
- case AGILENT_661x:
- {
- as_Power_Supply_GPIB_addr = read_661x_GPIB_Address("MF_setup.txt", Application->ExeName);
- }
- break;
- case AGILENT_663x2:
- {
- as_Power_Supply_GPIB_addr = read_663x2_GPIB_Address("MF_setup.txt", Application->ExeName);
- }
- break;
- case AGILENT_E3631A:
- {
- as_Power_Supply_GPIB_addr = read_E3631A_GPIB_Address("MF_setup.txt", Application->ExeName);
- }
- break;
- case KEITHLEY_2306:
- {
- as_Power_Supply_GPIB_addr = read_Keithley2306_GPIB_Address("MF_setup.txt", Application->ExeName);
- }
- break;
- default:
- {
- }
- break;
- }
- }
- m_Dcs.ADD = as_Power_Supply_GPIB_addr;
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::SetCalibrationParameter( void )
- {
- // flag
- m_Cal.b_ResetRfTester = cbResetRfTester->Checked;
- // initial file
- m_Cal.as_IniFile = stIniFile->Caption;
- // cal path
- m_Cal.as_CalPath = stCalPath->Caption;
- // calibration item
- m_Cal.s_CalItem.b_ip2_cal = cbIP2->Checked && cbIP2->Visible;
- m_Cal.s_CalItem.b_afc_cal = cbAFC->Checked && cbAFC->Visible;
- m_Cal.s_CalItem.b_rx_path_loss_cal = cbRxPathLoss->Checked && cbRxPathLoss->Visible;
- m_Cal.s_CalItem.b_tx_iq_cal = cbTxIq->Checked && cbTxIq->Visible;
- m_Cal.s_CalItem.b_tx_pcl_cal = cbTxPcl->Checked && cbTxPcl->Visible;
- m_Cal.s_CalItem.b_trx_offset_cal = m_cbTrxOffset->Checked && m_cbTrxOffset->Visible;
- m_Cal.s_CalItem.b_adc_cal = cbADC->Checked && cbADC->Visible;
- m_Cal.s_CalItem.b_cv_cal = m_cbCV->Checked && m_cbCV->Visible;
- m_Cal.s_CalItem.b_wifi_tx_dc_offset_cal = cbWiFiTxDcOffset->Checked && cbWiFiTxDcOffset->Visible;
- m_Cal.s_CalItem.b_wifi_tx_power_cal = cbWiFiTxPower->Checked && cbWiFiTxPower->Visible;
- m_Cal.s_CalItem.b_bt_cap_id_cal = m_cbBTCapID->Checked && m_cbBTCapID->Visible;
- // AFC type
- if (rbTCVCXO->Checked)
- {
- m_Cal.e_AFC_type = TCVCXO;
- }
- else
- {
- m_Cal.e_AFC_type = CRYSTAL;
- }
- // Crystal AFC option
- if (rbTCVCXO->Checked)
- {
- m_Cal.s_crystal_afc_option.crystal_cap_id_update = RUN_TIME;
- }
- else
- {
- m_Cal.s_crystal_afc_option.crystal_cap_id_update = WRITE_NVARM;
- }
- // m_Cal.s_crystal_afc_option.b_tx_afc_offset_cal = m_cbTrxOffset->Checked;
- // TX IQ
- if ((RF_ID_A60111A == m_Cal.ui_rf_id) ||
- (RF_ID_MT6140A == m_Cal.ui_rf_id) ||
- (RF_ID_MT6140B == m_Cal.ui_rf_id) ||
- (RF_ID_MT6140C == m_Cal.ui_rf_id) ||
- (RF_ID_MT6140D == m_Cal.ui_rf_id) ||
- (RF_ID_AERO2E == m_Cal.ui_rf_id)
- )
- {
- if ((MT6205 == m_Cal.e_bb_chip) ||
- (MT6205B == m_Cal.e_bb_chip) ||
- (MT6217 == m_Cal.e_bb_chip) ||
- (MT6218 == m_Cal.e_bb_chip) ||
- (MT6218B == m_Cal.e_bb_chip) ||
- (MT6219 == m_Cal.e_bb_chip) ||
- (MT6223 == m_Cal.e_bb_chip) ||
- (MT6223P == m_Cal.e_bb_chip) ||
- (MT6225 == m_Cal.e_bb_chip) ||
- (MT6226 == m_Cal.e_bb_chip) ||
- (MT6226D == m_Cal.e_bb_chip) ||
- (MT6226M == m_Cal.e_bb_chip) ||
- (MT6227 == m_Cal.e_bb_chip) ||
- (MT6227D == m_Cal.e_bb_chip) ||
- (MT6228 == m_Cal.e_bb_chip)
- )
- {
- m_Cal.e_TX_IQ_type = TX_IQ_GMSK;
- }
- else
- {
- m_Cal.e_TX_IQ_type = TX_IQ_EPSK;
- }
- }
- else
- {
- m_Cal.e_TX_IQ_type = TX_IQ_GMSK;
- }
- // PA type
- m_Cal.e_PA_type = (E_PA_TYPE_T) cbPAType->ItemIndex;
- // APC type
- if (m_rbGMSK2PCL->Checked)
- {
- m_Cal.e_GMSK_APC_type = TWO_PCL;
- }
- else if(m_rbGMSK3PCL->Checked)
- {
- m_Cal.e_GMSK_APC_type = THREE_PCL;
- }
- else if (m_rb6DAC->Checked)
- {
- m_Cal.e_GMSK_APC_type = SIX_DAC;
- }
- else
- {
- m_Cal.e_GMSK_APC_type = FULL_PCL;
- }
- if (m_rbEPSK1PCL->Checked)
- {
- m_Cal.e_EPSK_APC_type = ONE_PCL;
- }
- else if (m_rbEPSK2PCL->Checked)
- {
- m_Cal.e_EPSK_APC_type = TWO_PCL;
- }
- else if(m_rbEPSK3PCL->Checked)
- {
- m_Cal.e_EPSK_APC_type = THREE_PCL;
- }
- else if(m_rbEPSK4PCL->Checked)
- {
- m_Cal.e_EPSK_APC_type = FOUR_PCL;
- }
- else
- {
- m_Cal.e_EPSK_APC_type = FULL_PCL;
- }
- // APC modulation
- m_Cal.i_APC_mod = 0;
- if (m_cbGMSK->Checked)
- {
- m_Cal.i_APC_mod |= APC_MOD_GMSK;
- }
- if (m_cbEPSK->Checked)
- {
- m_Cal.i_APC_mod |= APC_MOD_EPSK;
- }
- // if (m_rbFixedPaBias->Checked)
- {
- m_Cal.e_PA_bias = PA_BIAS_FIXED;
- }
- // else
- // {
- // m_Cal.e_PA_bias = PA_BIAS_DYN;
- // }
- // TX slot
- if (rbSingleSlot->Checked )
- { m_Cal.e_tx_slot = TX_SLOT_SINGLE;
- }
- else
- { m_Cal.e_tx_slot = TX_SLOT_MULTI;
- }
- // BT tester
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmFatcory::cbPATypeChange(TObject *Sender)
- {
- switch (cbPAType->ItemIndex)
- {
- case RFMD_3140:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK3PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = false;
- m_gbEPSKTxPcl->Visible = false;
- }
- break;
- case RFMD_3159:
- //case SKY_77340:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK3PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = true;
- m_gbEPSKTxPcl->Visible = true;
- m_rbEPSK2PCL->Enabled = false;
- if (RF_ID_A60111A != m_Cal.ui_rf_id)
- {
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = true;
- if (!m_rbEPSKFullPCL->Checked)
- {
- m_rbEPSK4PCL->Checked = true;
- }
- }
- else
- {
- m_rbEPSK1PCL->Enabled = true;
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- if (!m_rbEPSKFullPCL->Checked)
- {
- m_rbEPSK1PCL->Checked = true;
- }
- }
- }
- break;
- case SKY_77340:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK3PCL->Checked = false;
- }
- m_rbGMSKFullPCL->Checked = true;
- m_rbGMSKFullPCL->Enabled = true;
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = true;
- m_gbEPSKTxPcl->Visible = true;
- m_rbEPSK2PCL->Enabled = false;
- if (RF_ID_A60111A != m_Cal.ui_rf_id)
- {
- m_rbEPSK1PCL->Enabled = false;
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = true;
- if (!m_rbEPSKFullPCL->Checked)
- {
- m_rbEPSK4PCL->Checked = true;
- }
- }
- else
- {
- m_rbEPSK1PCL->Enabled = true;
- m_rbEPSK2PCL->Enabled = false;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- if (!m_rbEPSKFullPCL->Checked)
- {
- m_rbEPSK1PCL->Checked = true;
- }
- }
- }
- break;
- case SKY_77328:
- case SKY_77506:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK2PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = false;
- m_gbEPSKTxPcl->Visible = false;
- //m_gbPaBias->Visible = false;
- }
- break;
- case SKY_77316:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK2PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = true;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = true;
- m_gbEPSKTxPcl->Visible = true;
- //m_gbPaBias->Visible = false;
- if (m_rbEPSK3PCL->Checked ||
- m_rbEPSK4PCL->Checked
- )
- {
- m_rbEPSK2PCL->Checked = true;
- }
- m_rbEPSK2PCL->Enabled = true;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- }
- break;
- case RENESAS_PF08155B:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK3PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_rb6DAC->Enabled = false;
- m_cbEPSK->Visible = false;
- m_gbEPSKTxPcl->Visible = false;
- // m_gbPaBias->Visible = false;
- }
- break;
- case AXIOM_AX502:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rb6DAC->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = false;
- m_rb6DAC->Enabled = true;
- m_cbEPSK->Visible = false;
- m_gbEPSKTxPcl->Visible = false;
- // m_gbPaBias->Visible = false;
- }
- break;
- case TRIQUINT_TQM6M5001:
- {
- if (!m_rbGMSKFullPCL->Checked)
- {
- m_rbGMSK3PCL->Checked = true;
- }
- m_rbGMSK2PCL->Enabled = false;
- m_rbGMSK3PCL->Enabled = true;
- m_cbEPSK->Visible = true;
- m_gbEPSKTxPcl->Visible = true;
- if (m_rbEPSK3PCL->Checked ||
- m_rbEPSK4PCL->Checked
- )
- {
- m_rbEPSK2PCL->Checked = true;
- }
- m_rbEPSK2PCL->Enabled = true;
- m_rbEPSK3PCL->Enabled = false;
- m_rbEPSK4PCL->Enabled = false;
- }
- break;
- // case RENESAS_PF09016B:
- // {
- // if( m_rbGMSK2PCL->Checked )
- // m_rbGMSK3PCL->Checked = true;
- //
- // m_rbGMSK2PCL->Enabled = false;
- // m_rbGMSK3PCL->Enabled = true;
- // }
- // break;
- default:
- {
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::FormActivate(TObject *Sender)
- {
- if ( m_bInit )
- {
- m_bInit = false;
- CMETAHANDLE META_HANDLE_Obj;
- m_Cal.i_MainMETAHandle = META_HANDLE_Obj.Get_MainHandle();
- // update UI
-
- // hForm_MF = this->Handle;
- // MF_ctrl.hPostMsgDestHandle = this->Handle;
- // hForm_PostMsgTarget = this->Handle;
- //WindowProc = SubClassWndProc;
- // Query_TwoApcDcOffset_Support();
-
- m_Cal.ui_rf_id = frmMainSel->Get_FinalRFID();
- m_Cal.e_bb_chip = frmMainSel->Get_FinalBBChip();
- m_Cal.s_wifi_cap = frmMainSel->Get_FinalWiFiCap();
- BT_ModuleID_S* p_bt_moduleid = frmMainSel->Get_BTMoudleID();
- m_Cal.s_bt_bb_id = *p_bt_moduleid;
- //IP2
- if( //RF_ID_MT6139B == m_Cal.ui_rf_id ||
- // RF_ID_MT6139C == m_Cal.ui_rf_id ||
- // RF_ID_MT6139E == m_Cal.ui_rf_id ||
- // RF_ID_MT6140A == m_Cal.ui_rf_id ||
- // RF_ID_MT6140B == m_Cal.ui_rf_id ||
- RF_ID_SKY74045 == m_Cal.ui_rf_id ||
- RF_ID_SKY74117 == m_Cal.ui_rf_id ||
- RF_ID_SKY74400 == m_Cal.ui_rf_id
- )
- {
- cbIP2->Visible = true;
- }
- else
- {
- cbIP2->Checked = false;
- cbIP2->Visible = false;
- }
- // TADO
- m_Cal.b_TADOSupport = frmMainSel->Get_TADO_Support();
- // RF capability
- m_Cal.RfCapability = frmMainSel->Get_FinalMSCap();
- // TX IQ version
- CRFTXIQRUN RF_TXIQRUN_Obj;
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- m_Cal.e_bbtxcfg_ver = RF_TXIQRUN_Obj.Query_BBTxCfgVer_Start(bb_chip);
- if( b_OpenCfgFile )
- {
- char cM_PM;
- META_factory_cfg->getM_PM( cM_PM );
- if( (cM_PM >= 5) && (0 == m_Cal.RfCapability.capability.Calibration_8PM) )
- {
- Application->MessageBox( "MS support at most 4 PM per frame, please modify M_PM value in CFG file" , "Warning", MB_OK );
- }
- else if( cM_PM > 8 )
- {
- Application->MessageBox( "MS support at most 8 PM per frame, please modify M_PM value in CFG file" , "Warning", MB_OK );
- }
- }
- // multislot TX
- CRFMULTISLOTTX RF_MULTI_SLOT_TX_Obj;
- m_Cal.b_MultiSlotTxExSupport = RF_MULTI_SLOT_TX_Obj.Query_MultiSlotTxEx_Start();
- // WiFi ALC
- CWIFIALC WIFI_ALC_Obj;
- m_Cal.b_WiFiAlcSupport = WIFI_ALC_Obj.REQ_Query_ALC_Suppport_Start();
- // BT
- if ((BTMODULE_MT6601 == m_Cal.s_bt_bb_id.id) ||
- (BTMODULE_MT6611 == m_Cal.s_bt_bb_id.id)
- )
- {
- m_cbBTCapID->Visible = true;
- }
- else
- {
- m_cbBTCapID->Visible = false;
- m_cbBTCapID->Checked = false;
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbTCVCXOClick(TObject *Sender)
- {
- m_cbTrxOffset->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::rbCrystalClick(TObject *Sender)
- {
- m_cbTrxOffset->Visible = true;
- }
- //---------------------------------------------------------------------------