access_rxpathloss.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:5k
- /*****************************************************************************
- * 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_rxpahloss.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RX path loss 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
- #ifndef _ACCESS_RXPATHLOSS_H_
- #include "access_rxpathloss.h"
- #endif
- #ifndef _RF_AGC_H_
- #include "rf_agc.h"
- #endif
- //===========================================================================
- //===========================================================================
- CACCESSRXPATHLOSS::CACCESSRXPATHLOSS( void )
- {
- }
- //---------------------------------------------------------------------------
- CACCESSRXPATHLOSS::~CACCESSRXPATHLOSS( )
- {
- }
- //------------------------------------------------------------------------------
- void CACCESSRXPATHLOSS::SetTabNameToPATHLOSS_PARAMETERS( TADOTable *p_ADOTab )
- {
- p_ADOTab->Active = false;
- p_ADOTab->TableName = "PATHLOSS_PARAMETERS";
- p_ADOTab->Active = true;
- }
- //----------------------------------------------------------------------------
- void CACCESSRXPATHLOSS::PostRecordToAccess( TADOTable *p_ADOTab )
- {
- p_ADOTab->Post();
- }
- //------------------------------------------------------------------------------
- bool CACCESSRXPATHLOSS::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 CACCESSRXPATHLOSS::AddBarcodeToAccess( TADOTable *p_ADOTab, AnsiString as_ID )
- {
- if(! AddFieldToAccess( p_ADOTab, "BARCODE", as_ID ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSRXPATHLOSS::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 CACCESSRXPATHLOSS::AddDateToAccess( TADOTable *p_ADOTab )
- {
- if(! AddFieldToAccess( p_ADOTab, "DATE", DateToStr(Date()) ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSRXPATHLOSS::AddTimeToAccess( TADOTable *p_ADOTab )
- {
- if(! AddFieldToAccess( p_ADOTab, "TIME", CurrentTimeStr() ) ) return false;
- return true;
- }
- //------------------------------------------------------------------------------
- bool CACCESSRXPATHLOSS::AddRxPathLossParameterToAccess( TADOTable *p_ADOTab, FrequencyBand freqband,
- l1cal_agcPathLoss_T *p_AgcPathLoss)
- {
- AnsiString as_SUBBAND_NAME[] =
- {
- "GSM400",
- "GSM850",
- "GSM",
- "DCS",
- "PCS"
- };
- try
- {
- for(int i=0; i<PLTABLE_SIZE-1; i++)
- {
- p_ADOTab->FieldByName( as_SUBBAND_NAME[freqband] + "_ARFCN" + IntToStr(i+1) )->AsInteger =
- p_AgcPathLoss->agcPathLoss[freqband][i].max_arfcn;
- p_ADOTab->FieldByName( as_SUBBAND_NAME[freqband] + "_RX_LOSS" + IntToStr(i+1) )->AsString =
- p_AgcPathLoss->agcPathLoss[freqband][i].gain_offset*1.0/GAIN_SCALE;
- }
- }
- catch(...)
- {
- AnsiString as_msg = "add RX path loss fields error";
- throw EDatabaseError(as_msg);
- return false;
- }
- return true;
- }