⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 access_adc.cpp

📁 MTK 手机软件开发 META 源代码,开发环境: C++ Builder
💻 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 + -