META_Factory.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:269k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * META_Factory.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * META factory form source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <inifiles.hpp>
- #include <stdio.h>
- #pragma hdrstop
- // misc
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- #ifndef _TIME_UTILS_H_
- #include "time_utils.h"
- #endif
- #ifndef _MISC_BARCODE_H_
- #include "misc_barcode.h"
- #endif
- #ifndef _MISC_IMEI_H_
- #include "misc_imei.h"
- #endif
- // equipment
- #ifndef _RCT_COMMON_H_
- #include "rct_common.h"
- #endif
- #ifndef _DCS_COMMON_H_
- #include "dcs_common.h"
- #endif
- #include "META_factory_cfg.h"
- #include "meta_msg.h"
- #include "META_Factory.h"
- #include "META_factory_reboot_go.h"
- #include "META_error_handler.h"
- #include "META_Factory_AboutU.h"
- #include "com_utils.h"
- #include "TFT_Boot.h"
- #include "T_Init_Age8960.h"
- #include "meta_utils.h"
- #include "T_META_factory_calibration.h"
- ///
- #include "rf_apc.h"
- #include "rf_agc.h"
- #include "rf_afc.h"
- #include "crystal_afc.h"
- #include "man_dll.h"
- // form
- #include "form_Main.h"
- #include "form_CalPath.h"
- #include "form_CFGAfc.h"
- #include "form_CFGCrystalAfc.h"
- #include "form_CFGRxPathLoss.h"
- #include "form_CFGTxPcl.h"
- #ifndef form_CFGPhErrH
- #include "form_CFGPhErr.h"
- #endif
- #include "form_CFGADC.h"
- #include "form_CFGCommon.h"
- // ADC calibration
- #include "META_factory_ADC_cfg.h"
- // message
- #ifndef _META_LAB_MSG_H_
- #include "meta_lab_msg.h"
- #endif
- // query
- #ifndef _QUERY_COMMON_H_
- #include "query_common.h"
- #endif
- #ifndef _GNRL_MSCAP_H_
- #include "gnrl_mscap.h"
- #endif
- // handle
- #ifndef _MAN_HANDLE_H_
- #include "man_handle.h"
- #endif
- //RF
- #ifndef _RF_MULTISLOTTX_H_
- #include "rf_multislottx.h"
- #endif
- // WiFi
- #ifndef _WIFI_ALC_H_
- #include "wifi_alc.h"
- #endif
- //------------------------------------------------------------------------------
- #define MIN_FACTORY_ID 0
- #define MAX_FACTORY_ID 10000000000
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- //------------------------------------------------------------------------------
- //------------------------------------------------------------------------------
- // equipment
- //extern CMU_VAR cmu;
- TfrmFatcory *frmFatcory;
- HANDLE hForm_PostMsgTarget;
- HANDLE hForm_MF;
- // AGC
- CRFAGC* MF_rf_agc_ptr;
- // IP2
- CRFPM* MF_rf_pm_ptr;
- // AFC
- CRFAFC* MF_rf_afc_ptr;
- RfAfc_Req *MF_rf_afc_req;
- RfAfc_Cnf *MF_rf_afc_cnf;
- //RfSetAfcDacValue_Req *MF_rf_SetAfcDacValue;
- unsigned char RfSetAfcDacCnf = false;
- // crystal AFC
- CCRYSTALAFC* MF_crystal_afc_ptr;
- CBBREG* MF_bb_reg_ptr;
- // APC
- CRFAPC* MF_rf_apc_ptr;
- CRFAPC8PSK* MF_rf_apc_8psk_ptr;
- RfNbtx_Req *MF_rf_tx_level_req;
- bool MF_rf_tx_level_cnf;
- // phase error
- CRFTXIQ* MF_rf_txiq_ptr;
- // ADC
- CBBADC* MF_BB_ADC_ptr;
- ADCMeaData_Req* MF_BB_ADC_Req;
- ADCMeaData_Cnf *BBCnf_ADC;
- // Thread
- T_META_factory_calibration* pt_calibration;
- RfPm_Req *MF_rf_pm_req;
- RfPm_Cnf *MF_rf_pm_cnf;
- bool first_FactoryForm_Show = true;
- bool is_calibration_start = false;
- int TimerCalTimeoutID;
- // ADC
- int TimerADCCalTimeoutID;
- extern TfrmMainSel *frmMainSel;
- extern CNVRAMMan *NVRAMMan;
- extern bool is_suspend_cal; // in T_META_factory_calibration.cpp
- extern bool IS_AgilentPowerSupply_INITIALISE; // in T_Init_Age8960.cpp
- extern HANDLE hCOM; // in META_LAB_MainU.cpp
- extern bool is_age1960_fail; // in T_Init_Age8960.cpp
- extern bool is_AgilentPowerSupply_fail; // in T_Init_Age8960.cpp
- // query
- extern T_RFTADO* pt_rftado;
- extern T_RFID* pt_rfid;
- //extern bool is_Age8960_start;
- // reconnect
- bool IsReconnectByFactory = false;
- extern bool isBootTarget;
- //extern bool Bootok;
- extern bool g_bHideEnable;
- //===========================================================================
- //////////////////////// static function ///////////////////////////////////
- //===========================================================================
- static void CNF_NVRAMInitial( void )
- {
- frmFatcory->CNF_NVRAMInitial();
- }
- //---------------------------------------------------------------------------
- static void CNF_ReadFromNVRAM( void )
- { frmFatcory->UploadFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteToNVRAM( void )
- { frmFatcory->DownloadToFlashDone();
- }
- //--------------------------------------------------------------------------
- static void CNF_ReadIP2FromNVRAM( void )
- {
- frmFatcory->CNF_ReadIP2FromNVRAM();
- }
- //--------------------------------------------------------------------------
- static void CNF_WriteIP2ToNVRAM( void )
- {
- frmFatcory->CNF_WriteIP2ToNVRAM();
- }
- //---------------------------------------------------------------------------
- bool IsValidFactoryID( AnsiString &ansi_str, int &factory_id )
- {
- bool invalid = true;
- RANGE_CHECK_ERROR( !AnsiString_To_Integer( ansi_str, factory_id, MIN_FACTORY_ID, MAX_FACTORY_ID ), RANGE_ERR_FACTORY_ID );
- if((factory_id >= MIN_FACTORY_ID)&&(factory_id <=MAX_FACTORY_ID))
- { invalid = false;
- }
- RANGE_CHECK_ERROR( invalid, RANGE_ERR_FACTORY_ID );
- return( true );
- }
- //---------------------------------------------------------------------------
- __fastcall TfrmFatcory::TfrmFatcory(TComponent* Owner)
- : TForm(Owner)
- {
- m_Rct.cmu.RM = NULL;
- m_Rct.cmu.base = NULL;
- m_Rct.cmu.gsm = NULL;
- m_Rct.cmu.dcs = NULL;
- m_Rct.cmu.pcs = NULL;
- m_Rct.cmu.gsm850 = NULL;
- m_Rct.cmu.s_gsm = NULL;
- m_Rct.cmu.s_dcs = NULL;
- m_Rct.cmu.s_pcs = NULL;
- m_Rct.cmu.s_gsm850 = NULL;
- m_Rct.age.vi = NULL;
- m_sBtt.cmu.s_bt = NULL;
- }
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- void TfrmFatcory::CNF_NVRAMInitial(void)
- {
- E_METAAPP_RESULT_T state = NVRAMMan->Get_ConfirmState();
- if (METAAPP_NVRAM_INIT_FAIL == state)
- {
- Application->MessageBox( "Execution Failure : Initial NVRAM database", "FAILURE", MB_OK );
- }
- else if(METAAPP_TIMEOUT == state)
- {
- Application->MessageBox( "Execution Timeout : Initial NVRAM database", "TIMEOUT", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void _fastcall TfrmFatcory::SubClassWndProc( Messages::TMessage &Message)
- {
- AnsiString as_readTXPower_Q_error;
- switch ( Message.Msg )
- {
- //////////////////////////////////// Query //////////////////////////
- // RF ID
- // case WM_ML_QUERY_RFID_SUCCESS:
- // {
- // DisplayIP2Visible( t_rf_id.ui_rf_id.RfModId.id );
- // m_Cal.ui_rf_id = t_rf_id.ui_rf_id.RfModId.id;
- // }
- // break;
- //
- // case WM_ML_QUERY_RFID_FAILED:
- // {
- // cbIP2->Visible = false;
- // cbIP2->Checked = false;
- // m_Cal.ui_rf_id = RF_ID_UNKNOWN;
- // }
- // break;
- ////////////////////////// Agilent 8960 ////////////////////////////
- case WM_MF_AGE8960_SET_OPERATION_MODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set operation mode fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RCT_SET_CABLE_LOSS_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set cable loss fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_CODING_SCHEME_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set coding scheme fail!";
- MF_state = eError;
- write_log();
- //write_result();
- }
- break;
- case WM_MF_AGE8960_INIT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " initialize fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_DCL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " dcl fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_RESET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " reset fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_BAND_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set band fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_TRAN_CONT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set transmit continous fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_TRAN_BURST_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set transmit burst fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_BCH_ARFCN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set BCH ARFCN fail!";
- MF_state = eError;
- write_log();
- }
- break;
- // --------------------------------------- cmu ------------------
- case WM_MF_AGE8960_SET_RF_GENERATOR_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set RF generator fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_BURST_TRANSMIT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set burst transmit mode fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_GENERATOR_TSC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set generator TSC fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_BIT_MODULATION_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set bit modulation fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set power fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_TSC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TSC fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_TCH_ARFCN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TCH ARFCN fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_PDTCH_ARFCN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set PDTCH ARFCN fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_TCH_TIMESLOT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TCH timeslot fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_MESA_FUNC_TX_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TX power fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_MS_TX_LEVEL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set MS TX level fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_TX_POWER_CONT_ON_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TX power continuous ON fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " set TX power continuous OFF fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- case WM_MF_AGE8960_WAIT_FOR_INIT_DONE_Q_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " wait for init done Q fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_RESUME_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " resume fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_CONFIG_TX_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config TX power fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_CONFIG_PFER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config phase and frequency error fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_CONFIG_IQ_TUNNING_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config IQ tunning fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_READ_IQ_TUNNING_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " read IQ tunning fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_CONFIG_EPSK_MOD_ACCURACY_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config EPSK modulation accuracy fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_FETCH_EPSK_OOS_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " read EPSK original offset fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_FETCH_EPSK_SBS_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " read EPSK IQ imbalance fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_READ_TX_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " read TX power fail!";
- as_readTXPower_Q_error="";
- switch ( Message.LParam )
- {
- case 0: as_readTXPower_Q_error = " Normal";
- break;
- case 1: as_readTXPower_Q_error = " No Result Available";
- break;
- case 2: as_readTXPower_Q_error = " Measurement Timeout";
- break;
- case 3: as_readTXPower_Q_error = " Hardware Not Installed";
- break;
- case 4: as_readTXPower_Q_error = " Hardware Error";
- break;
- case 5: as_readTXPower_Q_error = " Over Range";
- break;
- case 6: as_readTXPower_Q_error = " Under Range";
- break;
- case 7: as_readTXPower_Q_error = " Burst Short";
- break;
- case 12: as_readTXPower_Q_error = " Oven Out of Range";
- break;
- default:
- case 13: as_readTXPower_Q_error = " Unidentified Error";
- break;
- } // switch
- st_Log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " +
- m_Rct.as_RCT + " > read TX power fail."+
- as_readTXPower_Q_error
- );
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_MESA_FUNC_PFER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config TX frequency error fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_READ_PFER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " read TX frequency error fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_SET_MESA_FUNC_IQ_TUNNING_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " config TX IQ tunning fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AGE8960_CLOSE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = m_Rct.as_RCT + " close handle fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_PT_BOOT_RESUME_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " PT boot resume fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_PT_CALIBRATION_NEW_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " PT calibration new fail!";
- MF_state = eError;
- write_log();
- }
- break;
- ////////////////////////// Query ////////////////////////////
- case WM_MF_QUERY_RFTWOAPCDOOFFSET_SUCCESS:
- {
- m_Cal.b_TADOSupport = true;
- }
- break;
- case WM_MF_QUERY_RFTWOAPCDOOFFSET_FAILED:
- {
- m_Cal.b_TADOSupport = false;
- }
- break;
- ////////////////////////// CFG file ////////////////////////////
- case WM_MF_CFG_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read config file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_CFG_CHECK_PCL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " CHECK_PCL error in config file!";
- MF_state = eError;
- write_log();
- }
- break;
- ////////////////////////// INI file ////////////////////////////
- case WM_MF_INI_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read initial file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WF_MF_INI_RX_PATH_LOSS_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " No RX path loss section in initial file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- ////////////////////////// LOG file ////////////////////////////
- case WM_MF_LOG_OPEN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Open logging file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_LOG_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write logging file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- // baseband
- case WM_MF_BB_REG_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read baseband register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BB_REG_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write baseband register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BB_REG_SET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Set baseband register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- // messages for META facotry RF calibration
- ////////////////////////// RF general ////////////////////////
- case WM_MF_RF_SELECTBAND_CNF_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " selected band fail!";
- write_log();
- }
- break;
- case WM_MF_RF_SELECTBAND_CNF_SUCCESS:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " selected band success!";
- write_log();
- }
- break;
- case WM_MF_RF_STOP_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Stop RF fail!";
- MF_state = eError;
- write_log();
- }
- break;
- ////////////////////////// AFC ////////////////////////////
- case WM_MF_RF_AFC_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- if( rbTCVCXO->Checked )
- {
- lb_META_factory_status->Caption = " AFC calibration in progress!";
- }
- else
- {
- lb_META_factory_status->Caption = " AFC slope calibration in progress!";
- }
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_CONTROL_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- write_log();
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_RF_SET_AFC_DAC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC set DAC value fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_SET_AFC_DAC_CNF_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC set DAC value cnf fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_SELECT_BAND_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC calibration select band fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_AFC_NOT_CHECK:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Please turn on AFC calibration for TX IQ or TRX offset calibration";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_CONTROL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_GET_AFCDAC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Get target AFC DAC value fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_AFC_WRITE_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- write_log();
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_NVRAM_AFC_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read AFC slope and offset from flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_AFC_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write AFC calibration value to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_AFCDATA_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_AFCDATA_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " AFC calibration write calibration data to file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_AFC_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " AFC calibration done!";
- MF_state = eAFC;
- write_log();
- }
- break;
- /////////////////////// crystal AFC /////////////////////////////////
- case WM_MF_RF_CRYSTAL_AFC_CAPID_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " Crystal CAPID calibration in progress!";
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_CAPID_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " Crystal CAPID calibration done!";
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_CONTROL_START:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " Crystal AFC calibration in progress!";
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_SELECT_BAND_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration select band fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_CRYSTAL_AFC_CAPID_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write AFC calibration CAP ID to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_CRYSTAL_CAPDATA_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_CRYSTAL_CAPDATA_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_CONTROL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration control fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_TX_LEVEL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration send NB fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_PRECHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration pre-check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_SET_CRYSTAL_AFC_DAC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration set AFC DAC fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_SET_CRYSTAL_AFC_DAC_CNF_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration set AFC DAC cnf fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration write calibration data to file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_SET_CAPID_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration set CAP ID fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_ALL_FREQ_ERR_POSITIVE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration all frequency error are positive fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_ALL_FREQ_ERR_NEGATIVE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Crystal AFC calibration all frequency error are negative fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_TRX_OFFSET_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TRX offset calibration in progress!";
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_TRX_OFFSET_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TRX offset calibration done!";
- MF_state = eAFC;
- write_log();
- }
- break;
- case WM_MF_RF_CRYSTAL_AFC_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " AFC calibration done!";
- MF_state = eAFC;
- write_log();
- }
- break;
- ////////////////////////// RX path loss ////////////////////////////
- case WM_MF_RF_PM_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " RX path loss calibration in progress!";
- MF_state = eRF_PathLoss;
- write_log();
- }
- break;
- case WM_MF_RF_PM_INI_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " RX pathloss section not in initial file" ;
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_PM_SUPPORT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " PM setting in CFG file exceed mobile capability, PM setting = " + IntToStr(Message.WParam) +", MS capability = " + IntToStr(Message.LParam) ;
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_PM_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " Path loss calibration in progress!";
- write_log();
- if(is_suspend_cal && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_RF_PM_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Path loss calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_PM_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Path loss calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_PATH_LOSS_WRITE_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- write_log();
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_NVRAM_PATH_LOSS_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write path loss calibration value to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_AGCPATHLOSS_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_AGCPATHLOSS_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_PM_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Path loss calibration write calibration data to file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_PM_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " RX path loss calibration done!";
- MF_state = eRF_PathLoss;
- write_log();
- }
- break;
- ////////////////////////// IP2 ////////////////////////////
- case WM_MF_RF_IP2_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " IP2 calibration progress!";
- MF_state = eIP2;
- write_log();
- }
- break;
- case WM_MF_NVRAM_IP2_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read IP2 calibration value from flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_IP2_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write IP2 calibration value to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_RFSPECIALCOEF_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_RFSPECIALCOEF_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_AMCALMODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set rxamcalmode to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_MAG_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set mag to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_POL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set pol to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_CW2_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set CW2 to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_CW7_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set CW7 to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_BCCODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 set B, C code to register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_SET_MT6139_COEF_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 Set MT6139 coefficient fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_GET_ACODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 get acode from register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_GET_CW7_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 get CW7 from register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_GET_BCCODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 get B, C code from register fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_PM_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 calibration PM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " IP2 calibration write calibration data to file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_IP2_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " IP2 calibration done!";
- MF_state = eIP2;
- write_log();
- }
- break;
- ////////////////////////// TX PCL ////////////////////////////
- case WM_MF_RF_TX_LEVEL_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX power control level calibration in progress!";
- MF_state = eTX_PCL;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX power control level calibration in progress!";
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_RF_TX_LEVEL_INI_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " APC section is not in initial file!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_QUERY_ITC_PCL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Query modulator switch PCL fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX PCL calibration send NB fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_EVALDAC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX power control level evaluate DAC value fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX power control level check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_MAX_APC_DAC_OUT_OF_RANGE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " MAX APC DAC out of range fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_SET_APC_DAC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " set TX PCL DAC fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_SET_APC_DC_OFFSET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " set APC DC offset fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX PCL calibration write calibration data to file fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_LEVEL_RAMP_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read TX power control level from flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_LEVEL_RAMP_WRITE_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- write_log();
- //write_result(); // added by Andy Ueng
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_NVRAM_LEVEL_RAMP_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write TX power control level to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_RAMPTABLE_xxx_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_RAMPTABLE_xxx_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_EPSK_RAMPTABLE_xxx_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_EPSK_RAMPTABLE_xxx_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_SET_RAMPAPCLEVEL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Set ramp APC level fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_SET_RAMPAPCLEVEL_CNF:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- write_log();
- if(is_suspend_cal && pt_calibration != NULL)
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- break;
- case WM_MF_RF_A60111A_ENTER_FACTORY_MODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " A60111A enter factory mode fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_A60111A_READ_REF_TEMP_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " A60111A read temp_ref fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_REF_TEMP_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " write A60111A temp_ref to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX PCL calibration done!";
- MF_state = eTX_PCL;
- write_log();
- }
- break;
- case WM_MF_RF_TX_LEVEL_CALIBRATION_DONE_NO_CHECK:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX PCL calibration done!(without TX PCL check)";
- MF_state = eTX_PCL;
- write_log();
- }
- break;
- ////////////////////// Trim, offset IQ calibration ///////////////////
- case WM_MF_RF_TX_IQ_FAIL:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX IQ calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_GET_BB_TX_CFG_FAIL:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " RF get BB TX config fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_SET_BB_TX_CFG_FAIL:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " RF set BB TX config fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_GAIN_AUTO_CAL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX gain auto calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_IQ_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX IQ calibration progress!";
- MF_state = eTX_DcOffset;
- write_log();
- }
- break;
- case WM_MF_NVRAM_TXIQ_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write TX IQ calibration data to flash fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_L1_TXIQ_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_L1_TXIQ_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_IQ_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " TX IQ calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RF_TX_IQ_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " TX IQ calibration done!";
- MF_state = eTX_DcOffset;
- write_log();
- }
- break;
- ////////////////////// calibration general //////////////////////////
- case WM_MF_CA_SUCCESS:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- after_Calibration_TerminateSuccess( NULL );
- }
- break;
- case WM_MF_CA_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- after_Calibration_Fail( NULL );
- }
- break;
- case WM_MF_CA_TERM_BY_USER:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- after_Calibration_TerminateByUser( NULL );
- }
- break;
- case WM_MF_CALIBRATION_TIMER_TIME_OUT:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Calibration timer timeout!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_RECONNECT_WITH_TARGET_SUCCESS:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- ReconnectWithTargetSuccess();
- }
- break;
- //-----------------
- ////////////////////////// META dll ////////////////////////////
- case WM_META_DLL_ERROR_FRAME_ERROR:
- {
- MessageBox(NULL, "Frame error!", NULL, MB_OK);
- }
- break;
- case WM_META_DLL_ERROR_NO_CALLBACK:
- {
- MessageBox(NULL, "There is no callback function for some confirm!", NULL, MB_OK);
- }
- break;
- case WM_META_DLL_ERROR_PRIMITIVE_ERROR:
- {
- MessageBox(NULL, "Corrupt primitive", NULL, MB_OK);
- }
- break;
- case WM_META_DLL_ERROR_UNDEFINE_ERROR:
- {
- MessageBox(NULL, "Unknow error!", NULL, MB_OK);
- }
- break;
- case WM_META_DLL_FAILED:
- {
- if (NULL == hCOM)
- Application->MessageBox( " COM port is not initialized." , "Fail", MB_OK );
- else
- Application->MessageBox( " FAILED ", "Fail", MB_OK );
- }
- break;
- case WM_META_DLL_COMM_FAIL:
- {
- Application->MessageBox( " Communication between PC and target is failed ", "Fail", MB_OK );
- }
- break;
- case WM_META_DLL_NORESPONSE:
- {
- Application->MessageBox( " NO response ", "Fail", MB_OK );
- }
- break;
- case WM_META_DLL_BUFFER_LEN:
- {
- Application->MessageBox( " Buffer length is not enough ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_GROUP_INVALID:
- {
- Application->MessageBox( " NVRAM group id invalid ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_ELEMENT_INVALID:
- {
- Application->MessageBox( " NVRAM element id invalid ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_FIELD_INVALID:
- {
- Application->MessageBox( " NVRAM field invalid ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_VALUE_LEN:
- {
- Application->MessageBox( " value of length is incorrect ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_FILE_BAD:
- {
- Application->MessageBox( " This file is bad.", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_PARAM_INVALID:
- {
- Application->MessageBox( " parameter invalid ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_INTERNAL_DB_ERR:
- {
- Application->MessageBox( " meta dll internal db error ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_NO_MEMORY:
- {
- Application->MessageBox( " meta dll no memory ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_INVALID_ARGUMENTS:
- {
- Application->MessageBox( " meta dll invalid arguments ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_TIMEOUT:
- {
- Application->MessageBox( " meta dll timeout ", "Error", MB_OK );
- }
- break;
- case WM_META_DLL_BUSY:
- {
- Application->MessageBox( " meta dll busy ", "Error", MB_OK );
- }
- break;
- ////////////////////////// power supply ///////////////////////////
- case WM_MF_ADC_DCS_INIT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Power supply init fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- //case WM_MF_AGE663x2_INIT_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent 663x2 init fail!";
- // MF_state = eError;
- /// write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- // case WM_MF_AGEE3631A_INIT_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent E3631A init fail!";
- // MF_state = eError;
- // write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- // case WM_MF_RESUME_AGE661x_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent 661x resume fail!";
- // MF_state = eError;
- // write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- // case WM_MF_RESUME_AGE663x2_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent 663x2 resume fail!";
- // MF_state = eError;
- // write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- case WM_MF_ADC_DCS_MEASURE_VOLTAGE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Power supply measure voltage fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- // case WM_MF_AGE663x2_MEASURE_VOLTAGE_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent 663x2 measure voltage fail!";
- //// MF_state = eError;
- // write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- case WM_MF_ADC_DCS_CLOSE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Power supply close fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- // case WM_MF_AGE663x2_CLOSE_FAIL:
- // lb_META_factory_status->Font->Color = clRed;
- // lb_META_factory_status->Caption = " Agilent 663x2 close fail!";
- // MF_state = eError;
- // write_log();
- // //write_result(); // added by Andy Ueng
- // break;
- case WM_MF_ADC_DCS_SET_VOLTAGE_CURRENT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Set voltage and current of power supply fail!";
- MF_state = eError;
- write_log();
- //write_result(); // added by Andy Ueng
- }
- break;
- ////////////////////////// ADC ////////////////////////////
- case WM_MF_ADC_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " ADC calibration in progress!";
- MF_state = eADC;
- write_log();
- }
- break;
- case WM_MF_PT_ADC_CALIBRATION_NEW_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC PT calibration new fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_MEASURE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC calibration ADC measure fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_EVALUATE_SLOPE_OFFSET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC calibration evaluate slope offset fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_CHECK_BATTERY_VOLTAGE_DIFFERENCE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC calibration check battery voltage difference fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_CHECK_CURRENT_DIFFERENCE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC calibration check current difference fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_CHECK_SLOPE_OFFSET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " ADC calibration check slope offset fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_ADC_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write ADC slope and offset to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_ADC_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_ADC_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_ADC_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read ADC slope and offset from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_ADC_CHECK_SLOPE_OFFSET_PASS:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " ADC calibration check slope and offset pass!";
- }
- break;
- case WM_MF_ADC_SUCCESS:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- after_Calibration_TerminateSuccess( NULL );
- }
- break;
- case WM_MF_ADC_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- after_Calibration_Fail( NULL );
- }
- break;
- case WM_MF_ADC_TERM_BY_USER:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- after_Calibration_TerminateByUser( NULL );
- }
- break;
- case WM_MF_ADC_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " ADC calibration done!";
- write_log();
- }
- break;
- /////////////////////////// CV calibration ////////////////////////////
- case WM_MF_CV_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " CV calibration in progress!";
- MF_state = eCV;
- write_log();
- }
- break;
- case WM_MF_CV_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " CV calibration check fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_CV_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read CV from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_CV_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write CV to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_CV_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " CV calibration done!";
- write_log();
- }
- break;
- /////////////////////////// WiFi common ////////////////////////////
- case WM_MF_WIFI_CHANNEL_INDEX_NOT_FOUND_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi channel index not found fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_RATE_802_11B_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Incorrect 802.11b TX rate fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_RATE_802_11AG_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " 802.11a, 802.11g TX rate should be 48 or 54 MHz!";
- MF_state = eError;
- write_log();
- }
- break;
- ////////////////////////// WiFi Equipment ////////////////////////////
- case WM_LOAD_N4010A_DLL_FAILED:
- case WM_LOAD_N4010A_DLL_FUNCTION_FAILED:
- {
- Application->MessageBox("Load Agilent N40410A AgN4010WSODrv.dll fail", "Warning", MB_OK );
- }
- break;
- ////////////////////////// WiFi TX power ////////////////////////////
- case WM_MF_WIFI_CPT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi TX power calibration continuous packet TX fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_CPT_STOP_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi TX power calibration stop continuous packet TX fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_APC_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi TX power calibration read WiFi TX power from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_APC_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi TX power calibration write WiFi TX power to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_ALC_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read WiFi ALC from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_ALC_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " write WiFi ALC to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_WNDRV_DAC_DC_OFFSET_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_WNDRV_DAC_DC_OFFSET_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_TX_DC_OFFSET_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read WiFi TX DC offset from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_WIFI_TX_DC_OFFSET_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write WiFi TX DC offset to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_WNDRV_TX_POWER_xxx_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_WNDRV_TX_POWER_xxx_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_WNDRV_TX_ALC_POWER_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_WNDRV_TX_ALC_POWER_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_WNDRV_ALC_SLOPE_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_WNDRV_ALC_SLOPE_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_POWER_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " WiFi TX power calibration in progress!";
- MF_state = eWIFI_TXPCL;
- write_log();
- }
- break;
- case WM_MF_WIFI_INIT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester init fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TERMINATE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester terminate fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_CONN_OPEN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester connection open fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_CONN_UPDATE_CALDATA_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester update calibration data fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_CONN_CLOSE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester connection close fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_SET_DEFAULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester sets default value fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_SET_PACKET_LEN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester sets packet length fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_SET_TRIGGER_STYLE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester sets trigger style fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_APPLY_CHANGE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester applies change value fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_SET_CENTRAL_FREQ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester sets central frequency fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_SET_POWER_RANGE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester sets power range fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_DATA_CAPTURE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester captures data fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_ANALYZE_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester analyzes TX power fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_READ_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi tester reads TX power fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_POWER_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " WiFi TX power calibration done!";
- MF_state = eWIFI_TXPCL;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_DC_OFFSET_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " WiFi TX DC offset calibration in progress!";
- MF_state = eWIFI_TXPCL;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_DC_OFFSET_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " WiFi TX DC offset calibration fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_WIFI_TX_DC_OFFSET_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " WiFi TX DC offset calibration done!";
- MF_state = eWIFI_TXPCL;
- write_log();
- }
- break;
- ///////////////////////////////// BT tester ///////////////////////
- case WM_MF_BTT_INIT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester initialize fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CLOSE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester close fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_SLAVE_PARAMETER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config slave parameter fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_DOWNLINK_POWER_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config BD address fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_BD_ADDRESS_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config BD address fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_INQUIRY_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config inquiry parameter fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_SCAN_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config scan parameter fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_INQUIRY_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester inquiry fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONNECT_TEST_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester connect testmode fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_RELEASE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester release connection fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_QUERY_STATE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester query state fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_CONFIG_MOD_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester config modulation fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BTT_READ_FREQ_ACCURACY:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT tester read frequency accuracy fail";
- MF_state = eError;
- write_log();
- }
- break;
- ///////////////////////////////// BT CAP ID ///////////////////////
- case WM_MF_BT_CRYSTAL_CAPID_BEGIN:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " BT CAP ID calibration in progress";
- MF_state = eBT_CAP_ID;
- write_log();
- }
- break;
- case WM_MF_BT_CRYSTAL_CAPID_WRITE_CAL_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write BT CAP ID to .cal file fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_ENABLE_PCM_CLOCK_SYNC_SIGNAL_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Enable PCM clock sync. signal fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_START_CALIBRATE_CRYSTAL_CLOCK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT start to calibrate crystal clock fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_READ_CRYSTAL_CLOCK_RESULT_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT read crystal clock result fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_SET_CRYSTAL_CAPID_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT set crystal CAP ID fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_CRYSTAL_CAPID_CHECK_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT CAP ID calibration check fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_ENTER_TEST_MODE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT enter test mode fail";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_INQUIRY_ENABLE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " BT inquiry enable fail";
- write_log();
- }
- break;
- case WM_MF_NVRAM_BT_INFO_READ_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Read BT info. from NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_BT_INFO_WRITE_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " Write BT info. to NVRAM fail!";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_NVRAM_EF_BTRADIO_MT6601_LID_VERNO_FAIL:
- {
- lb_META_factory_status->Font->Color = clRed;
- lb_META_factory_status->Caption = " NVRAM_EF_BTRADIO_MT6601_LID version is not support, please update META to latest version.";
- MF_state = eError;
- write_log();
- }
- break;
- case WM_MF_BT_CRYSTAL_CAPID_CALIBRATION_DONE:
- {
- lb_META_factory_status->Font->Color = clWindowText;
- lb_META_factory_status->Caption = " BT crystal CAP ID calibration done";
- MF_state = eInit;
- write_log();
- }
- break;
- default:
- {
- this->WndProc(Message);
- }
- break;
- } // switch
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::write_log()
- {
- FILE *pf;
- try
- {
- if ( b_SetupLogFile )
- {
- // st_Log->SaveToFile(as_LogFileName);
- if( (pf = fopen( as_LogFileName.c_str() ,"at+")) == NULL )
- {
- AnsiString as_warning_msg;
- as_warning_msg = "Cannot open output file: " + as_LogFileName;
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- return;
- }
- if ( NULL == st_Log )
- {
- return;
- }
- for(int I=0; I<st_Log->Count; I++)
- {
- fprintf(pf, AnsiString(st_Log->Strings[I] + "n").c_str() );
- } // for
- fclose(pf);
- st_Log->Clear();
- } // if
- } // try
- catch(...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " write log file error "+as_LogFileName;
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::write_result()
- {
- FILE *pf;
- if(m_Cal.as_ResultBuf.AnsiCompare("") == 0)
- return;
- try
- {
- if ( b_SetupResultFile )
- {
- if ((pf = fopen( as_ResultFileName.c_str() ,"at+")) == NULL)
- {
- AnsiString as_warning_msg;
- as_warning_msg = "Cannot open output file: " + as_ResultFileName;
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- return;
- }
- // modified by Andy Ueng
- // fprintf(pf, AnsiString(ResultHeaderBuf2 + "n").c_str());
- fprintf(pf, AnsiString(m_Cal.as_ResultBuf + "n").c_str());
- // for( int I=0; I<st_Result->Count; I++)
- // {
- // fprintf(pf, AnsiString(st_Result->Strings[I] + "n").c_str() );
- // } // for
- fclose(pf);
- // st_Result->Clear();
- //ResultHeaderBuf2 = "";
- m_Cal.as_ResultBuf = "";
- // end of modified
- } // if
- } // try
- catch(...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " write result file error "+as_ResultFileName;
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::clear_log()
- {
- st_Log->Clear();
- }
- //---------------------------------------------------------------------------
- void TfrmFatcory::clear_result()
- {
- // modified by Andy Ueng
- //st_Result->Clear();
- //ResultHeaderBuf2 = "";
- m_Cal.as_ResultBuf = "";
- // end of modified
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_Calibration_TerminateByUser(TObject *Sender)
- {
- on_Calibration_TerminateByUser_function();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_Calibration_TerminateByUser_function(void)
- {
- DisableAllCalTimer();
- is_calibration_start = false;
- PostMessage(
- this->Handle,
- WM_MF_CA_TERM_BY_USER,
- 0,
- 0
- );
- //////////////////////// RF calibration /////////////////////////////////////////
- if (cbIP2->Checked ||
- cbAFC->Checked ||
- cbRxPathLoss->Checked ||
- cbTxIq->Checked ||
- cbTxPcl->Checked ||
- m_cbTrxOffset->Checked
- )
- {
- RCT_Dcl_Reset_Close();
- }
- //////////////////////// BT CAP ID calibration /////////////////////////////////////////
- if (m_cbBTCapID->Checked)
- {
- if (!m_btt_ctrl.BTT_Close(&m_sBtt))
- {
- PostMessage(
- this->Handle,
- WM_MF_BTT_CLOSE_FAIL,
- 0,
- 0
- );
- }
- }
- ///////////////////////////// ADC calibration ///////////////////////////////////////////
- if(cbADC->Checked)
- {
- if( m_Dcs.vi )
- {
- SetNormalVoltage_CloseAgilentPowerSupply();
- }
- else
- {
- InitAgilentPowerSupply_SetNormalVoltage_CloseAgilentPowerSupply();
- }
- //PostMessage(
- // this->Handle,
- // WM_MF_ADC_TERM_BY_USER,
- // 0,
- // 0
- // );
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::after_Calibration_TerminateByUser(TObject *Sender)
- {
- lb_META_factory_status->Caption = " Calibration terminated by user";
- st_Log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Calibration terminated by user"
- );
- write_log();
- clear_log();
- write_result(); // added by Andy Ueng
- // bb_Start->Kind = bkOK;
- bb_Start->Tag = BUTTON_TAG_START;
- bb_Start->Enabled = true;
- bb_Start->Caption = "Start (F6)";
- if( cbIP2->Checked ||
- cbAFC->Checked ||
- cbRxPathLoss->Checked ||
- cbTxIq->Checked ||
- cbTxPcl->Checked
- )
- {
- MF_state = eInit;
- CRFSTOP RF_STOP_Obj;
- RF_STOP_Obj.REQ_Start();
- }
- if( cbADC->Checked )
- {
- MF_state = eInit;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_Calibration_Fail(TObject *Sender)
- {
- on_Calibration_Fail_function();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmFatcory::on_Calibration_Fail_function( void )
- {
- DisableAllCalTimer();
- //////////////////////// RF calibration //////////////////////////////////////