?? access_adc.cpp
字號:
/*****************************************************************************
* 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_adc.cpp
*
* Project:
* --------
* Maui META APP
*
* Description:
* ------------
* ADC 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_ADC_H_
#include "access_adc.h"
#endif
#ifndef _BB_ADC_H_
#include "bb_adc.h"
#endif
//===========================================================================
//===========================================================================
CACCESSADC::CACCESSADC( void )
{
}
//---------------------------------------------------------------------------
CACCESSADC::~CACCESSADC( )
{
}
//------------------------------------------------------------------------------
void CACCESSADC::SetTabNameToADC_PARAMETERS( TADOTable *p_ADOTab )
{
p_ADOTab->Active = false;
p_ADOTab->TableName = "ADC_PARAMETERS";
p_ADOTab->Active = true;
}
//----------------------------------------------------------------------------
void CACCESSADC::PostRecordToAccess( TADOTable *p_ADOTab )
{
p_ADOTab->Post();
}
//------------------------------------------------------------------------------
bool CACCESSADC::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 CACCESSADC::AddBarcodeToAccess( TADOTable *p_ADOTab, AnsiString as_ID )
{
if(! AddFieldToAccess( p_ADOTab, "BARCODE", as_ID ) ) return false;
return true;
}
//------------------------------------------------------------------------------
bool CACCESSADC::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 CACCESSADC::AddDateToAccess( TADOTable *p_ADOTab )
{
if(! AddFieldToAccess( p_ADOTab, "DATE", DateToStr(Date()) ) ) return false;
return true;
}
//------------------------------------------------------------------------------
bool CACCESSADC::AddTimeToAccess( TADOTable *p_ADOTab )
{
if(! AddFieldToAccess( p_ADOTab, "TIME", CurrentTimeStr() ) ) return false;
return true;
}
//------------------------------------------------------------------------------
bool CACCESSADC::AddADCParameterToAccess( TADOTable *p_ADOTab, bmt_adcdata *p_AdcData,
int i_BATTERY_CHANNEL, int i_CHARGER_CHANNEL )
{
try
{
p_ADOTab->FieldByName("BAT_CH_SLOPE")->AsString = p_AdcData->ADCSlope[i_BATTERY_CHANNEL];
p_ADOTab->FieldByName("BAT_CH_OFFSET")->AsString = p_AdcData->ADCOffset[i_BATTERY_CHANNEL];
p_ADOTab->FieldByName("CHAR_CH_SLOPE")->AsString = p_AdcData->ADCSlope[i_CHARGER_CHANNEL];
p_ADOTab->FieldByName("CHAR_CH_OFFSET")->AsString = p_AdcData->ADCOffset[i_CHARGER_CHANNEL];
}
catch(...)
{
AnsiString as_msg = "add ADC fields error";
throw EDatabaseError(as_msg);
return false;
}
return true;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -