access_apc.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:6k
- /*****************************************************************************
- * 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) 2001
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * access_apc.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * APC calibration export to Microsoft Access 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 <IniFiles.hpp>
- #pragma hdrstop
- // Access
- #ifndef _ACCESS_APC_H_
- #include "access_apc.h"
- #endif
- // RF
- #ifndef _RF_APC_H_
- #include "rf_apc.h"
- #endif
- // misc
- #ifndef _BAND_UTILS_H_
- #include "band_utils.h"
- #endif
- #ifndef _META_UTILS_H_
- #include "meta_utils.h"
- #endif
- #ifndef _META_CONST_H_
- #include "meta_const.h"
- #endif
- //===========================================================================
- //===========================================================================
- CACCESSAPC::CACCESSAPC( void )
- {
- }
- //---------------------------------------------------------------------------
- CACCESSAPC::~CACCESSAPC( )
- {
- }
- //------------------------------------------------------------------------------
- void CACCESSAPC::SetTabNameToAPC_PARAMETERS( TADOTable *p_ADOTab )
- {
- p_ADOTab->Active = false;
- p_ADOTab->TableName = "APC_PARAMETERS";
- p_ADOTab->Active = true;
- }
- //------------------------------------------------------------------------------
- void CACCESSAPC::SetTabNameToAPC_PCL_POWER( TADOTable *p_ADOTab )
- {
- p_ADOTab->Active = false;
- p_ADOTab->TableName = "APC_PCL_POWER";
- p_ADOTab->Active = true;
- }
- //----------------------------------------------------------------------------
- void CACCESSAPC::PostRecordToAccess( TADOTable *p_ADOTab )
- {
- p_ADOTab->Post();
- }
- //------------------------------------------------------------------------------
- bool CACCESSAPC::AddFieldToAccess( TADOTable *p_ADOTab, AnsiString as_fieldname, AnsiString as_fieldvalue )
- {
- try
- {
- p_ADOTab->FieldByName(as_fieldname)->AsString = as_fieldvalue;
- }
- catch(...)
- {
- AnsiString as_msg = "add " + as_fieldname + " fields error";
- throw EDatabaseError(as_msg);
- return false;
- }
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSAPC::AddBarcodeToAccess( TADOTable *p_ADOTab, AnsiString as_ID )
- {
- if(! AddFieldToAccess( p_ADOTab, "BARCODE", as_ID ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSAPC::AddPcToAccess( TADOTable *p_ADOTab )
- {
- char hostname[256];
- unsigned long len=256;
- GetComputerName( hostname, &len );
- if(! AddFieldToAccess( p_ADOTab, "PC", hostname ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSAPC::AddDateToAccess( TADOTable *p_ADOTab )
- {
- if(! AddFieldToAccess( p_ADOTab, "DATE", DateToStr(Date()) ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSAPC::AddTimeToAccess( TADOTable *p_ADOTab )
- {
- if(! AddFieldToAccess( p_ADOTab, "TIME", CurrentTimeStr() ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- void CACCESSAPC::AddTxPcldBmParameterToAccess( TADOTable *p_ADOTab, FrequencyBand freqband,
- AnsiString as_tx_pcl, double **p_PCL_dBm)
- {
- AnsiString as_SUBBAND_NAME[] =
- {
- "GSM400",
- "GSM850",
- "GSM",
- "DCS",
- "PCS"
- };
- AnsiString as_sub_tx_pcl;
- AnsiString asFieldName;
- int i_sub_tx_pcl;
- #if 0
- switch( freqband )
- {
- case FrequencyBand850:
- if( ! META_factory_cfg->getGSM850_PCL( as_tx_pcl ) )
- {
- Application->MessageBox( "get GSM850 PCL fail" , "Error", MB_OK );
- return;
- }
- break;
- case FrequencyBand900:
- if( ! META_factory_cfg->getGSM900_PCL( as_tx_pcl ) )
- {
- Application->MessageBox( "get GSM900 PCL fail" , "Error", MB_OK );
- return;
- }
- break;
- case FrequencyBand1800:
- if( ! META_factory_cfg->getDCS1800_PCL( as_tx_pcl ) )
- {
- Application->MessageBox( "get DCS1800 PCL fail" , "Error", MB_OK );
- return;
- }
- break;
- case FrequencyBand1900:
- if( ! META_factory_cfg->getPCS1900_PCL( as_tx_pcl ) )
- {
- Application->MessageBox( "get PCS1900 PCL fail" , "Error", MB_OK );
- return;
- }
- break;
- default:
- assert(false);
- break;
- }
- #endif
- int band = FreqBand_To_BandIdx( freqband );
- for(int i=0; i<16; i++)
- {
- if (band == FrequencyBand900 && i==15 )
- {
- continue;
- }
- if (! getAnsiStrSubItem( as_tx_pcl, i+1, DEFAULT_SEP_CHAR, as_sub_tx_pcl) )
- {
- Application->MessageBox( "get PCL sub item fail" , "Error", MB_OK );
- return;
- }
- i_sub_tx_pcl = as_sub_tx_pcl.ToInt();
- asFieldName = as_SUBBAND_NAME[band] + "_PCL" + IntToStr(i_sub_tx_pcl) +"_P";
- p_ADOTab->FieldByName( asFieldName)->AsInteger = p_PCL_dBm[band][i];
- }
- }