form_BaseBand.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:70k
- /*****************************************************************************
- * 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:
- * ---------
- * form_Baseband.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Baseband 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 <stdio.h>
- #pragma hdrstop
- #ifndef _METAAPP_COMMON_H_
- #include "METAAPP_common.h"
- #endif
- #ifndef _FORM_BASEBAND_H_
- #include "form_BaseBand.h"
- #endif
- #ifndef _FORM_MAIN_H_
- #include "form_main.h"
- #endif
- #ifndef _FORM_PMICREG_H_
- #include "form_pmicreg.h"
- #endif
- #ifndef _MISC_BB_H_
- #include "misc_bb.h"
- #endif
- #ifndef _MAN_FDM_H_
- #include "man_fdm.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmBaseBand *frmBaseBand;
- bool FormBaseBandFirstShow = true;
- extern TfrmMainSel *frmMainSel;
- //---------------------------------------------------------------------------
- //==============================================================================
- static void CNF_PMIC_ReadRegister( void )
- { frmBaseBand->PMIC_ReadRegister_Done();
- }
- //--------------------------------------------------------------------------
- static void CNF_PMIC_WriteRegister( void )
- { frmBaseBand->PMIC_WriteRegister_Done();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- static void CNF_ReadFromNVRAM( void )
- { frmBaseBand->UploadFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_BG_ReadFromNVRAM( void )
- { frmBaseBand->UploadBGFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteToNVRAM( void )
- { frmBaseBand->DownloadToFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_BG_WriteToNVRAM( void )
- { frmBaseBand->DownloadBGToFlashDone();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- static void CNF_LED_SetLightLevel(void)
- {
- frmBaseBand->CNF_LED_SetLightLevel();
- }
- //---------------------------------------------------------------------------
- static void CNF_LED_MainLCDLightLevel(void)
- {
- frmBaseBand->CNF_LED_MainLCDLightLevel();
- }
- //---------------------------------------------------------------------------
- static void CNF_LED_SubLCDLightLevel(void)
- {
- frmBaseBand->CNF_LED_SubLCDLightLevel();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- static void CNF_VBR_TurnOnVibrator(void)
- {
- frmBaseBand->CNF_VBR_TurnOnVibrator();
- }
- //---------------------------------------------------------------------------
- static void CNF_VBR_TurnOffVibrator(void)
- {
- frmBaseBand->CNF_VBR_TurnOffVibrator();
- }
- //---------------------------------------------------------------------------
- // RTC
- static void CNF_RTC_Query(void)
- {
- frmBaseBand->CNF_RTC_Query();
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //===========================================================================
- __fastcall TfrmBaseBand::TfrmBaseBand(TComponent* Owner)
- : TForm(Owner)
- {
- m_edtSlope[0] = edtSlope0; m_edtOffset[0] = edtOffset0; m_btnADC[0] = btnADC0;
- m_edtSlope[1] = edtSlope1; m_edtOffset[1] = edtOffset1; m_btnADC[1] = btnADC1;
- m_edtSlope[2] = edtSlope2; m_edtOffset[2] = edtOffset2; m_btnADC[2] = btnADC2;
- m_edtSlope[3] = edtSlope3; m_edtOffset[3] = edtOffset3; m_btnADC[3] = btnADC3;
- m_edtSlope[4] = edtSlope4; m_edtOffset[4] = edtOffset4; m_btnADC[4] = btnADC4;
- m_edtSlope[5] = edtSlope5; m_edtOffset[5] = edtOffset5; m_btnADC[5] = btnADC5;
- m_edtSlope[6] = edtSlope6; m_edtOffset[6] = edtOffset6; m_btnADC[6] = btnADC6;
- for (int i=0; i<TOTAL_6218_ADC_NUM; i++)
- {
- m_edtSlope[i]->Tag = 1;
- m_edtOffset[i]->Tag = 0;
- }
- edtInput1->Tag = 0;
- edtInput2->Tag = 0;
- m_iCurAdcChannel = 0;
- m_uiBBRegAddr = 0x20;
- m_usBBRegValue = 0x20;
- m_uiPMICRegAddr = 0x3000;
- m_usPMICRegValue = 0;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- m_iFinalBBChip = frmMainSel->Get_FinalBBChip();
- // ADC
- if (MT6205 == m_iFinalBBChip || MT6205B == m_iFinalBBChip)
- {
- btnADC5->Enabled = false;
- btnADC6->Enabled = false;
- edtSlope5->Enabled = false;
- edtSlope6->Enabled = false;
- edtOffset5->Enabled = false;
- edtOffset6->Enabled = false;
- Display_AdcBatteryChannel( m_iFinalBBChip );
- Display_AdcChargerChannel( m_iFinalBBChip );
- }
- // PMIC register
- if (! m_cBB_PMIC_REG_Obj.Query_PMIC_ID_Start())
- {
- m_sPmicId.id = FT_MT_UNKNOWN;
- }
- PMIC_ID* psPmicId;
- psPmicId = m_cBB_PMIC_REG_Obj.Get_PMIC_ID();
- m_sPmicId = *psPmicId;
- if (FT_MT6318 == m_sPmicId.id)
- {
- btnPMICReg->Caption = "MT6318 PMIC register setting ...";
- btnPMICReg->Visible = true;
- }
- else
- {
- btnPMICReg->Visible = false;
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::FormHide(TObject *Sender)
- {
- Force_BB_Stop();
- }
- //===========================================================================
- void TfrmBaseBand::CurrentPageReset( void )
- {
- switch (pctlToolSel->ActivePageIndex)
- {
- case BB_PAGEIDX_ADC:
- {
- btnMeasureAdcStart1->Tag = STOP_TAG;
- btnMeasureAdcStart1->Enabled = true;
- btnMeasureAdcStart2->Tag = STOP_TAG;
- btnMeasureAdcStart2->Enabled = true;
- btnAdcUploadFromFlash->Enabled = true;
- btnAdcDownloadToFlash->Enabled = true;
- btnADCChangeDB->Enabled = true;
- }
- break;
- case BB_PAGEIDX_BB_REG:
- {
- btnBBRegRead->Enabled = true;
- btnBBRegWrite->Enabled = true;
- }
- break;
- case BB_PAGEIDX_PMIC_REG:
- {
- btnPMICRegRead->Enabled = true;
- btnPMICRegWrite->Enabled = true;
- }
- break;
- case BB_PAGEIDX_BATTERY:
- {
- btnBGUploadFromFlash->Enabled = true;
- btnBGDownloadToFlash->Enabled = true;
- btnBGChangeDB->Enabled = true;
- }
- break;
- case BB_PAGEIDX_LED:
- {
- m_btnKeypadLEDSet->Enabled = true;
- m_btnMainLCDSet->Enabled = true;
- //m_btnSubLCDSet->Enabled = true;
- }
- break;
- case BB_PAGEIDX_VBR:
- {
- btnVBROn->Enabled = true;
- btnVBROff->Enabled = true;
- }
- break;
- case BB_PAGEIDX_RTC:
- {
- btnRTCQuery->Enabled = true;
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::CurrentPageLock( void )
- {
- switch (pctlToolSel->ActivePageIndex)
- {
- case BB_PAGEIDX_ADC:
- {
- btnMeasureAdcStart1->Tag = START_TAG;
- btnMeasureAdcStart1->Enabled = false;
- btnMeasureAdcStart2->Tag = START_TAG;
- btnMeasureAdcStart2->Enabled = false;
- btnAdcUploadFromFlash->Enabled = false;
- btnAdcDownloadToFlash->Enabled = false;
- btnADCChangeDB->Enabled = false;
- }
- break;
- case BB_PAGEIDX_BB_REG:
- {
- btnBBRegRead->Enabled = false;
- btnBBRegWrite->Enabled = false;
- }
- break;
- case BB_PAGEIDX_PMIC_REG:
- {
- btnPMICRegRead->Enabled = false;
- btnPMICRegWrite->Enabled = false;
- }
- break;
- case BB_PAGEIDX_BATTERY:
- {
- btnBGUploadFromFlash->Enabled = false;
- btnBGDownloadToFlash->Enabled = false;
- btnBGChangeDB->Enabled = false;
- }
- break;
- case BB_PAGEIDX_LED:
- {
- m_btnKeypadLEDSet->Enabled = false;
- m_btnMainLCDSet->Enabled = false;
- //m_btnSubLCDSet->Enabled = false;
- }
- break;
- case BB_PAGEIDX_VBR:
- {
- btnVBROn->Enabled = false;
- btnVBROff->Enabled = false;
- }
- break;
- case BB_PAGEIDX_RTC:
- {
- btnRTCQuery->Enabled = false;
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmBaseBand::pctlToolSelChange(TObject *Sender)
- {
- Force_BB_Stop();
- ReDrawFields( (E_BB_PAGEIDX_T)pctlToolSel->ActivePageIndex );
- }
- //===========================================================================
- void TfrmBaseBand::ShowHintLabel( TControl *sender, char* hint )
- {
- TPoint pt0 = this->ClientOrigin;
- TPoint pt1 = sender->ClientOrigin;
- lblHint->Left = (pt1.x-pt0.x);
- lblHint->Top = (pt1.y-pt0.y)+sender->Height+3;
- lblHint->Caption = hint;
- lblHint->Visible = true;
- HintTimer->Enabled = true;
- }
- //---------------------------------------------------------------------------
- bool TfrmBaseBand::CheckFields( void )
- {
- int i;
- int data;
- AnsiString text;
- int total_adc_num;
- switch ((E_BB_PAGEIDX_T) pctlToolSel->ActivePageIndex)
- {
- case BB_PAGEIDX_ADC:
- {
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if (MT6205 == bb_chip || MT6205B == bb_chip)
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- for (i=0; i<total_adc_num; i++)
- {
- text = m_edtSlope[i]->Text; if( !IsValidADCSlope( text,data ) ) { edtSlopeCheck(m_edtSlope[i]); return false; }
- text = m_edtOffset[i]->Text; if( !IsValidADCOffset( text,data ) ) { edtOffsetCheck(m_edtSlope[i]); return false; }
- }
- text = edtInput1->Text; if( !IsValidADCInput( text,data ) ) { edtInputCheck(edtInput1); return false; }
- text = edtInput2->Text; if( !IsValidADCInput( text,data ) ) { edtInputCheck(edtInput2); return false; }
- }
- break;
- case BB_PAGEIDX_BB_REG:
- {
- unsigned int idata;
- unsigned short sdata;
- text = edtBBAddress->Text; if (!IsValidHexRegAddr(text, idata)) {edtRegAddrCheck(edtBBAddress); return false; }
- m_uiBBRegAddr = idata;
- text = edtBBValue->Text;
- if( DEC_FORMAT == btnBBRegValue->Tag ) // Dec
- {
- if (!IsValidDecRegValue(text, sdata))
- {
- edtRegValueCheck(edtBBValue);
- return false;
- }
- }
- else // Hex
- {
- if (!IsValidHexRegValue(text, sdata))
- {
- edtRegValueCheck(edtBBValue);
- return false;
- }
- }
- m_usBBRegValue = sdata;
- }
- break;
- case BB_PAGEIDX_PMIC_REG:
- {
- unsigned int idata;
- unsigned short sdata;
- text = edtPMICAddress->Text; if (!IsValidHexRegAddr(text, idata)) {edtRegAddrCheck(edtPMICAddress); return false; }
- m_uiPMICRegAddr = idata;
- text = edtPMICValue->Text;
- if( DEC_FORMAT == btnPMICRegValue->Tag ) // Dec
- {
- if (!IsValidDecRegValue(text, sdata))
- {
- edtPMICValueCheck(edtPMICValue);
- return false;
- }
- }
- else // Hex
- {
- if (!IsValidHexRegValue(text, sdata))
- {
- edtPMICValueCheck(edtPMICValue);
- return false;
- }
- }
- m_usPMICRegValue = sdata;
- }
- break;
- default:
- break;
- }
- return true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtSlopeCheck(TObject *Sender)
- {
- AnsiString text;
- int data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidADCSlope( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- edit->Tag = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtOffsetCheck(TObject *Sender)
- {
- AnsiString text;
- int data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidADCOffset( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- edit->Tag = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtInputCheck(TObject *Sender)
- {
- AnsiString text;
- int data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidADCInput( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- edit->Tag = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRegAddrCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned int data;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidHexRegAddr( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_uiBBRegAddr = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRegValueCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned short data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( DEC_FORMAT == btnBBRegValue->Tag ) // Dec
- {
- if( !IsValidDecRegValue( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- else // Hex
- {
- if( !IsValidHexRegValue( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- m_usBBRegValue = data;
- }
- //===========================================================================
- void TfrmBaseBand::Display_AdcBatteryChannel( int bb_chip )
- {
- cbADCBatteryChannel->ItemIndex = 0;
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::Display_AdcChargerChannel( int bb_chip )
- {
- if( MT6205 == bb_chip || MT6205B == bb_chip )
- {
- cbADCChargerChannel->ItemIndex = 3;
- }
- else
- {
- cbADCChargerChannel->ItemIndex = 1;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::ReDrawFields(E_BB_PAGEIDX_T e_pageidx)
- {
- char str[256];
- int total_adc_num;
- switch (e_pageidx)
- {
- case BB_PAGEIDX_ADC:
- {
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if (MT6205 == bb_chip || MT6205B == bb_chip)
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- for (int i=0; i<total_adc_num; i++)
- {
- m_edtSlope[i]->Text = m_edtSlope[i]->Tag;
- m_edtOffset[i]->Text = m_edtOffset[i]->Tag;
- }
- sprintf(str, "ADC %d", m_iCurAdcChannel);
- pnlProfileTitle->Caption = str;
- sprintf(str, "%.3f", (float)(edtInput1->Tag/1000.0) );
- edtInput1->Text = str;
- sprintf(str, "%.3f", (float)(edtInput2->Tag/1000.0) );
- edtInput2->Text = str;
- char buf[50];
- sprintf(buf, "%.1f", m_BB_ADC_Obj.Get_ADC_Output(0));
- txtOutput1->Caption = buf;
- sprintf(buf, "%.1f", m_BB_ADC_Obj.Get_ADC_Output(1) );
- txtOutput2->Caption = buf;
- btnApply->Enabled = (txtOutput1->Tag!=txtOutput2->Tag)&&(edtInput1->Tag&&edtInput2->Tag);
- if (btnApply->Enabled)
- {
- float x0 = m_BB_ADC_Obj.Get_ADC_Output(0);
- float x1 = m_BB_ADC_Obj.Get_ADC_Output(1);
- int y0 = edtInput1->Tag;
- int y1 = edtInput2->Tag;
- float fdata;
- if (x0-x1!=0)
- {
- fdata = 1.0*(y1-y0)/(x1-x0);
- fdata += (fdata>=0) ? 0.5 : -0.5 ;
- txtResultSlope->Tag = (int)fdata;
- fdata = y0 - 1.0*(y1-y0)/(x1-x0)*x0;
- fdata += (fdata>=0) ? 0.5 : -0.5 ;
- txtResultOffset->Tag = (int)fdata;
- }
- }
- txtResultSlope->Caption = txtResultSlope->Tag;
- txtResultOffset->Caption = txtResultOffset->Tag;
- }
- break;
- case BB_PAGEIDX_BB_REG:
- {
- sprintf(str, "%08lx", m_uiBBRegAddr);
- edtBBAddress->Text = str;
- if (DEC_FORMAT == btnBBRegValue->Tag) // Dec
- {
- btnBBRegValue->Caption = "Value (Dec)";
- lblBBRegValue0X->Visible = false;
- edtBBValue->Text = IntToStr(m_usBBRegValue);
- }
- else // Hex
- {
- btnBBRegValue->Caption = "Value (Hex)";
- lblBBRegValue0X->Visible = true;
- sprintf( str, "%X", (int)m_usBBRegValue );
- edtBBValue->Text = str;
- }
- }
- break;
- case BB_PAGEIDX_PMIC_REG:
- {
- sprintf(str, "%08lx", m_uiPMICRegAddr);
- edtPMICAddress->Text = str;
- if (DEC_FORMAT == btnPMICRegValue->Tag) // Dec
- {
- btnPMICRegValue->Caption = "Value (Dec)";
- lblPMICRegValue0X->Visible = false;
- edtPMICValue->Text = IntToStr(m_usPMICRegValue);
- }
- else // Hex
- {
- btnPMICRegValue->Caption = "Value (Hex)";
- lblPMICRegValue0X->Visible = true;
- sprintf( str, "%X", (int)m_usPMICRegValue );
- edtPMICValue->Text = str;
- }
- }
- break;
- case BB_PAGEIDX_RTC:
- {
- edtRTCYear->Text = IntToStr(m_sRTC.m_rtc_year);
- edtRTCMonth->Text = IntToStr(m_sRTC.m_rtc_mon);
- edtRTCDay->Text = IntToStr(m_sRTC.m_rtc_day);
- edtRTCWDay->Text = IntToStr(m_sRTC.m_rtc_wday);
- edtRTCWHour->Text = IntToStr(m_sRTC.m_rtc_hour);
- edtRTCMinute->Text= IntToStr(m_sRTC.m_rtc_min);
- edtRTCSec->Text = IntToStr(m_sRTC.m_rtc_sec);
- }
- break;
- default:
-
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::ReDrawBGFields( void )
- {
- edtBGShutdown->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_SHUT_DOWN_IDX] );
- edtBGNoMoCall->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_NO_MO_CALL_IDX] );
- edtBGLowBatteryWarning->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_LOW_BATTERY_WARNING_IDX] );
- edtBGLevel1->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_LEVEL1_IDX] );
- edtBGLevel2->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_LEVEL2_IDX] );
- edtBGLevel3->Text = IntToStr( m_custom_hw_level.BatteryLevel[BATTERY_LEVEL_LEVEL3_IDX] );
- }
- //===========================================================================
- void TfrmBaseBand::Force_BB_Stop(void)
- {
- m_BB_ADC_Obj.REQ_Stop();
- m_BB_REG_Obj.REQ_Stop();
- m_BB_CUSTHW_Obj.REQ_Stop();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnAdcClick(TObject *Sender)
- {
- TButton *btn = (TButton*)Sender;
- m_iCurAdcChannel = btn->Tag;
- edtInput1->Tag = 0;
- edtInput2->Tag = 0;
- txtOutput1->Tag = 0;
- txtOutput2->Tag = 0;
- txtResultSlope->Tag = 0;
- txtResultOffset->Tag = 0;
- ReDrawFields(BB_PAGEIDX_ADC);
- }
- //---------------------------------------------------------------------------
- static void CNF_MeasureAdc1( void )
- { frmBaseBand->MeasureAdc1_Done();
- }
- //-------------------------------------
- void __fastcall TfrmBaseBand::btnMeasureAdcStart1Click(TObject *Sender)
- {
- m_BB_ADC_Obj.ConfirmCallback = ::CNF_MeasureAdc1;
- m_BB_ADC_Obj.REQ_Start(m_iCurAdcChannel, edtInput1->Tag, 0, edtMeasureCount->Text.ToInt());
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC progressing";
- }
- //-------------------------------------
- void TfrmBaseBand::MeasureAdc1_Done( void )
- {
- int state = m_BB_ADC_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- txtOutput1->Tag = m_BB_ADC_Obj.Get_ADC_Output(0);
- ReDrawFields(BB_PAGEIDX_ADC);
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC fail";
- Application->MessageBox( "Execution Failure : Measure auxliary ADC", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC timeout";
- Application->MessageBox( "Execution Timeout : Measure auxliary ADC", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC stop";
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- static void CNF_MeasureAdc2( void )
- { frmBaseBand->MeasureAdc2_Done();
- }
- //-------------------------------------
- void __fastcall TfrmBaseBand::btnMeasureAdcStart2Click(TObject *Sender)
- {
- m_BB_ADC_Obj.ConfirmCallback = ::CNF_MeasureAdc2;
- m_BB_ADC_Obj.REQ_Start(m_iCurAdcChannel, edtInput2->Tag, 1, edtMeasureCount->Text.ToInt());
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC progressing";
- }
- //-------------------------------------
- void TfrmBaseBand::MeasureAdc2_Done( void )
- {
- int state = m_BB_ADC_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- txtOutput2->Tag = m_BB_ADC_Obj.Get_ADC_Output(1);
- ReDrawFields(BB_PAGEIDX_ADC);
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC fail";
- Application->MessageBox( "Execution Failure : Measure auxliary ADC", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC timeout";
- Application->MessageBox( "Execution Timeout : Measure auxliary ADC", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Measure auxiliary ADC stop";
- }
- break;
- default:
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnApplyClick(TObject *Sender)
- {
- m_edtSlope[m_iCurAdcChannel]->Tag = txtResultSlope->Tag;
- m_edtOffset[m_iCurAdcChannel]->Tag = txtResultOffset->Tag;
- int battery_ch = cbADCBatteryChannel->Text.ToInt();
- int charger_ch = cbADCChargerChannel->Text.ToInt();
- if( m_iCurAdcChannel == battery_ch )
- {
- int total_adc_num;
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if( bb_chip == MT6205 || bb_chip == MT6205B )
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- for( int i=0; i<total_adc_num; i++ )
- {
- if( i != charger_ch )
- {
- m_edtSlope[i]->Tag = txtResultSlope->Tag;
- m_edtOffset[i]->Tag = txtResultOffset->Tag;
- }
- }
- }
- ReDrawFields(BB_PAGEIDX_ADC);
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Apply ADC slope and offset successfully";
- }
- //-----------------------------------------------
- void __fastcall TfrmBaseBand::btnAdcUploadFromFlashClick(TObject *Sender)
- {
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- m_BB_ADC_Obj.ConfirmCallback = ::CNF_ReadFromNVRAM;
- m_BB_ADC_Obj.REQ_Read_From_NVRAM_Start();
- CurrentPageLock();
- }
- //-----------------------------------------------
- void TfrmBaseBand::UploadFromFlashDone(void)
- {
- E_METAAPP_RESULT_T state = m_BB_ADC_Obj.Get_ConfirmState();
- int total_adc_num;
- CurrentPageReset();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if (MT6205 == bb_chip || MT6205B == bb_chip)
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- bmt_adcdata adc_data = m_BB_ADC_Obj.Get_AdcData();
- for (int i=0; i<total_adc_num; i++)
- {
- m_edtSlope[i]->Tag = adc_data.i_ADCSlope[i];
- m_edtOffset[i]->Tag = adc_data.i_ADCOffset[i];
- }
- m_iCurAdcChannel = 0;
- edtInput1->Tag = 0;
- edtInput2->Tag = 0;
- txtOutput1->Tag = 0;
- txtOutput2->Tag = 0;
- txtResultSlope->Tag = 0;
- txtResultOffset->Tag = 0;
- ReDrawFields(BB_PAGEIDX_ADC);
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Upload auxiliary ADC setting from flash successful";
- }
- break;
- case METAAPP_FAIL:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Upload auxiliary ADC setting from flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Upload auxiliary ADC setting form flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Upload auxiliary ADC setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload auxiliary ADC setting form flash", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Upload auxiliary ADC setting from flash stop";
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " NVRAM_EF_ADC_LID version is not support, please update META to latest version";
- Application->MessageBox( "Execution Warning : NVRAM_EF_ADC_LID version is not support, please update META to latest version", "WARNING", MB_OK );
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnAdcDownloadToFlashClick(TObject *Sender)
- {
- int i;
- int total_adc_num;
- if( !CheckFields() ) return;
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if( bb_chip == MT6205 || bb_chip == MT6205B )
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- bmt_adcdata adc_data;
- for(i=0; i<total_adc_num; i++)
- {
- adc_data.i_ADCSlope[i] = m_edtSlope[i]->Tag;
- adc_data.i_ADCOffset[i] = m_edtOffset[i]->Tag;
- }
- m_BB_ADC_Obj.Set_AdcData( adc_data );
- m_BB_ADC_Obj.ConfirmCallback = ::CNF_WriteToNVRAM;
- m_BB_ADC_Obj.REQ_Write_To_NVRAM_Start();
- }
- //-----------------------------------------------
- void TfrmBaseBand::DownloadToFlashDone( void )
- {
- int state = m_BB_ADC_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Download auxiliary ADC setting to flash successfully";
- ReDrawFields(BB_PAGEIDX_ADC);
- }
- break;
- case METAAPP_FAIL:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Download auxiliary ADC setting to flash fail";
- Application->MessageBox( "Execution Failure : Download auxiliary ADC setting to flash", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Download auxiliary ADC setting to flash timeout";
- Application->MessageBox( "Execution Timeout : Download auxiliary ADC setting to flash", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Download auxiliary ADC setting to flash stop";
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " NVRAM_EF_ADC_LID version is not support, please update META to latest version";
- Application->MessageBox( "Execution Warning : NVRAM_EF_ADC_LID version is not support, please update META to latest version", "WARNING", MB_OK );
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::btnAdcLoadFromFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int i;
- int total_adc_num;
- ok = OpenDialog->Execute();
- if( !ok )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Load auxiliary ADC setting from file fail";
- return;
- }
- strcpy( str, OpenDialog->FileName.c_str() );
- ok = m_BB_ADC_Obj.REQ_Read_From_File( str );
- if (ok)
- {
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if( bb_chip == MT6205 || bb_chip == MT6205B )
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- bmt_adcdata adc_data;
- adc_data = m_BB_ADC_Obj.Get_AdcData();
- for(i=0; i<total_adc_num; i++)
- {
- m_edtSlope[i]->Tag = adc_data.i_ADCSlope[i];
- m_edtOffset[i]->Tag = adc_data.i_ADCOffset[i];
- }
- m_iCurAdcChannel = 0;
- edtInput1->Tag = 0;
- edtInput2->Tag = 0;
- txtOutput1->Tag = 0;
- txtOutput2->Tag = 0;
- txtResultSlope->Tag = 0;
- txtResultOffset->Tag = 0;
- ReDrawFields(BB_PAGEIDX_ADC);
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Load auxiliary ADC setting from file successfully";
- }
- else
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Load auxiliary ADC setting from file fail";
- Application->MessageBox( "Execution Failure : Load auxiliary ADC setting from file", "FAILURE", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnAdcSaveToFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int i;
- int total_adc_num;
- ok = CheckFields();
- if(!ok)
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Save auxiliary ADC setting to file fail";
- return;
- }
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Save auxiliary ADC setting to file fail";
- return;
- }
- //if( frmMainSel->rb6205->Checked || frmMainSel->rb6205B->Checked)
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- if( bb_chip == MT6205 || bb_chip == MT6205B )
- {
- total_adc_num = TOTAL_6205B_ADC_NUM;
- }
- else
- {
- total_adc_num = TOTAL_6218_ADC_NUM;
- }
- bmt_adcdata adc_data;
- for(i=0; i<total_adc_num; i++)
- {
- //m_BB_ADC_Obj.AdcData.ADCSlope[i] = m_edtSlope[i]->Tag;
- //m_BB_ADC_Obj.AdcData.ADCOffset[i] = m_edtOffset[i]->Tag;
- adc_data.i_ADCSlope[i] = m_edtSlope[i]->Tag;
- adc_data.i_ADCOffset[i] = m_edtOffset[i]->Tag;
- }
- m_BB_ADC_Obj.Set_AdcData( adc_data );
- strcpy( str, SaveDialog->FileName.c_str() );
- ok = m_BB_ADC_Obj.REQ_Write_To_File( str );
- if( !ok )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Save auxiliary ADC setting to file fail";
- Application->MessageBox( "Execution Failure : Save auxiliary ADC setting to file", "FAILURE", MB_OK );
- }
- else
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Save auxiliary ADC setting to file successfully";
- }
- }
- //===========================================================================
- static void CNF_ReadRegister( void )
- { frmBaseBand->ReadRegister_Done();
- }
- //-----------------------------------------------
- void __fastcall TfrmBaseBand::btnBBRegReadClick(TObject *Sender)
- {
- if( !CheckFields() )
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register fail";
- return;
- }
- m_BB_REG_Obj.ConfirmCallback = ::CNF_ReadRegister;
- m_BB_REG_Obj.REQ_ReadRegister_Start(m_uiBBRegAddr);
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register progressing";
- }
- //-----------------------------------------------
- void TfrmBaseBand::ReadRegister_Done(void)
- {
- E_METAAPP_RESULT_T state = m_BB_REG_Obj.Get_ConfirmState();
- switch( state )
- {
- case METAAPP_SUCCESS:
- {
- m_usBBRegValue = m_BB_REG_Obj.Get_RegValue();
- ReDrawFields(BB_PAGEIDX_BB_REG);
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register fail";
- Application->MessageBox( "Execution Failure : Read Baseband register", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register timeout";
- Application->MessageBox( "Execution Timeout : Read Baseband register", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Read baseband register stop";
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteRegister( void )
- { frmBaseBand->WriteRegister_Done();
- }
- //-----------------------------------------------
- void __fastcall TfrmBaseBand::btnBBRegWriteClick(TObject *Sender)
- {
- if( !CheckFields() )
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register fail";
- Application->MessageBox( "Execution Failure : Write Baseband register", "FAILURE", MB_OK );
- return;
- }
- m_BB_REG_Obj.ConfirmCallback = ::CNF_WriteRegister;
- m_BB_REG_Obj.REQ_WriteRegister_Start(m_uiBBRegAddr, m_usBBRegValue);
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register progressing";
- }
- //-----------------------------------------------
- void TfrmBaseBand::WriteRegister_Done(void)
- {
- E_METAAPP_RESULT_T state = m_BB_REG_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register fail";
- Application->MessageBox( "Execution Failure : Write Baseband register", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register timeout";
- Application->MessageBox( "Execution Timeout : Write Baseband register", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- sbReg->Panels->Items[0]->Text = (AnsiString) " Write baseband register stop";
- }
- break;
- default:
- break;
- }
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::btnBBRegValueClick(TObject *Sender)
- {
- btnBBRegValue->Tag = (DEC_FORMAT == (E_VALUE_FORMAT_T) btnBBRegValue->Tag) ? HEX_FORMAT: DEC_FORMAT;
- ReDrawFields(BB_PAGEIDX_BB_REG);
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtMeasureCountCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned short data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = "value shall be 0 ~ 65535";
- text = edit->Text;
- if( !IsValidADCMeasureCount( text, data ) )
- { edit->Text = 0;
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_usMeasureCount = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnADCChangeDBClick(TObject *Sender)
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAdc->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- sbAdc->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- }
- //==============================================================================
- void __fastcall TfrmBaseBand::btnBGUploadFromFlashClick(TObject *Sender)
- {
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- m_BB_CUSTHW_Obj.ConfirmCallback = ::CNF_BG_ReadFromNVRAM;
- m_BB_CUSTHW_Obj.REQ_Read_From_NVRAM();
- btnBGUploadFromFlash->Enabled = false;
- btnBGDownloadToFlash->Enabled = false;
- }
- //-----------------------------------------------
- void TfrmBaseBand::UploadBGFromFlashDone( void )
- {
- int i;
- int state = m_BB_CUSTHW_Obj.Get_ConfirmState();
- switch( state )
- {
- case STATE_CUST_HW_OK:
- {
- m_custom_hw_level = m_BB_CUSTHW_Obj.Get_CustomHwLevel();
- if( m_bDownloadTrigger )
- {
- m_bDownloadTrigger = false;
- for( int i=0; i<VISIBLE_BATTERY_LEVEL_NUM; i++ )
- {
- // m_BB_CUSTHW_Obj.m_custom_hw_level.BatteryLevel[i] = m_uiBatteryLevelVoltage[i];
- m_BB_CUSTHW_Obj.Set_BatteryLevel( i, m_uiBatteryLevelVoltage[i] );
- }
- m_BB_CUSTHW_Obj.ConfirmCallback = ::CNF_BG_WriteToNVRAM;
- m_BB_CUSTHW_Obj.REQ_Write_To_NVRAM();
- }
- else
- {
- for( int i=0; i<VISIBLE_BATTERY_LEVEL_NUM; i++ )
- {
- m_uiBatteryLevelVoltage[i] = m_custom_hw_level.BatteryLevel[i];
- }
- ReDrawBGFields();
- sbBG->Panels->Items[0]->Text = (AnsiString) " Upload battery level setting from flash successful";
- btnBGUploadFromFlash->Enabled = true;
- btnBGDownloadToFlash->Enabled = true;
- }
- }
- break;
- case STATE_CUST_HW_FAIL:
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Upload battery level setting from flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Upload battery level setting form flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case STATE_CUST_HW_TIMEOUT:
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Upload battery level setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload battery level setting form flash", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case STATE_CUST_HW_STOP:
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Upload battery level setting from flash stop";
- }
- break;
- }
- }
- //==============================================================================
- void __fastcall TfrmBaseBand::btnBGDownloadToFlashClick(TObject *Sender)
- {
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialize fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialize fail", "FAILURE", MB_OK );
- return;
- }
- m_bDownloadTrigger = true;
- m_BB_CUSTHW_Obj.ConfirmCallback = ::CNF_BG_ReadFromNVRAM;
- m_BB_CUSTHW_Obj.REQ_Read_From_NVRAM();
- btnBGUploadFromFlash->Enabled = false;
- btnBGDownloadToFlash->Enabled = false;
- }
- //-----------------------------------------------
- void TfrmBaseBand::DownloadBGToFlashDone( void )
- {
- int state = m_BB_CUSTHW_Obj.Get_ConfirmState();
- if( state==STATE_CUST_HW_OK )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Download battery level setting to flash successfully";
- }
- else if( state==STATE_CUST_HW_FAIL )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Download battery level setting to flash fail, please check the version of load and NVRAM database are same.";
- Application->MessageBox( "Execution Failure : Download battery level setting to flash, please check the version of load and NVRAM database are same.", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- else if( state==STATE_CUST_HW_TIMEOUT )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Download battery level setting to flash timeout";
- Application->MessageBox( "Execution Timeout : Download battery level setting to flash", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- else if( state==STATE_CUST_HW_STOP )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Download battery level setting to flash stop";
- }
- btnBGUploadFromFlash->Enabled = true;
- btnBGDownloadToFlash->Enabled = true;
- }
- //==============================================================================
- void __fastcall TfrmBaseBand::btnBGChangeDBClick(TObject *Sender)
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- sbBG->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnBGLoadFromFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- float fdata;
- ok = OpenDialog->Execute();
- if( !ok )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Load battery level setting from file fail";
- Application->MessageBox( "Execution Failure : Load battery level setting from file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, OpenDialog->FileName.c_str() );
- ok = m_BB_CUSTHW_Obj.REQ_Read_From_File( str );
- if( ok )
- {
- for( int i=0; i<VISIBLE_BATTERY_LEVEL_NUM; i++ )
- {
- // m_custom_hw_level.BatteryLevel[i] = m_BB_CUSTHW_Obj.m_custom_hw_level.BatteryLevel[i];
- m_custom_hw_level.BatteryLevel[i] = m_BB_CUSTHW_Obj.Get_BatteryLevel( i );
- m_uiBatteryLevelVoltage[i] = m_custom_hw_level.BatteryLevel[i];
- }
- ReDrawBGFields();
- sbBG->Panels->Items[0]->Text = (AnsiString) " Load battery level setting from file successful";
- }
- else
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Load battery level setting from file fail";
- Application->MessageBox( "Execution Failure : Load battery level setting from file", "FAILURE", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnBGSaveToFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Save battery level setting to file fail";
- Application->MessageBox( "Execution Failure : Save battery level setting to file", "FAILURE", MB_OK );
- return;
- }
- for( int i=0; i<VISIBLE_BATTERY_LEVEL_NUM; i++ )
- {
- // m_BB_CUSTHW_Obj.m_custom_hw_level.BatteryLevel[i] = m_uiBatteryLevelVoltage[i];
- m_BB_CUSTHW_Obj.Set_BatteryLevel( i, m_uiBatteryLevelVoltage[i] );
- }
- strcpy( str, SaveDialog->FileName.c_str() );
-
- ok = m_BB_CUSTHW_Obj.REQ_Write_To_File( str );
- if( !ok )
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Save battery level setting to file fail";
- Application->MessageBox( "Execution Failure : Save battery level setting to file", "FAILURE", MB_OK );
- }
- else
- {
- sbBG->Panels->Items[0]->Text = (AnsiString) " Save battery level setting to file successfully";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtBatteryLevelVoltageCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned int data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = "value shall be 0 ~ 9999999";
- text = edit->Text;
- if( !IsValidBatteryLevelVoltage( text, data ) )
- {
- edit->Text = 0;
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_uiBatteryLevelVoltage[edit->Tag] = data;
- m_custom_hw_level.BatteryLevel[edit->Tag] = data;
-
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::FormCreate(TObject *Sender)
- {
- // BG
- m_bDownloadTrigger = false;
- for(int i=0; i<VISIBLE_BATTERY_LEVEL_NUM; i++ )
- {
- m_uiBatteryLevelVoltage[i] = 0;
- }
- Init();
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::Init( void )
- {
- m_bInit = true;
- frmPMICReg->Init();
- }
- //==========================================================================
- /////////////////////// PMIC //////////////////////////
- //==========================================================================
- void __fastcall TfrmBaseBand::btnPMICRegValueClick(TObject *Sender)
- {
- btnPMICRegValue->Tag = (DEC_FORMAT == (E_VALUE_FORMAT_T) btnPMICRegValue->Tag) ? HEX_FORMAT: DEC_FORMAT;
- ReDrawFields(BB_PAGEIDX_PMIC_REG);
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnPMICRegReadClick(TObject *Sender)
- {
- if( !CheckFields() )
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register fail";
- Application->MessageBox( "Execution Failure : Read PMIC register", "FAILURE", MB_OK );
- return;
- }
- m_cBB_PMIC_REG_Obj.ConfirmCallback = ::CNF_PMIC_ReadRegister;
- m_cBB_PMIC_REG_Obj.REQ_ReadRegister_Start( m_uiPMICRegAddr );
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register progressing";
- }
- //-----------------------------------------------
- void TfrmBaseBand::PMIC_ReadRegister_Done(void)
- {
- E_METAAPP_RESULT_T state = m_cBB_PMIC_REG_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_usPMICRegValue = m_cBB_PMIC_REG_Obj.Get_RegValue();
- ReDrawFields(BB_PAGEIDX_PMIC_REG);
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register fail";
- Application->MessageBox( "Execution Failure : Read PMIC register", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register timeout";
- Application->MessageBox( "Execution Timeout : Read PMIC register", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Read PMIC register stop";
- }
- break;
- default:
- break;
- }
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmBaseBand::btnPMICRegWriteClick(TObject *Sender)
- {
- if( !CheckFields() )
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write PMIC register fail";
- Application->MessageBox( "Execution Failure : Write PMIC register", "FAILURE", MB_OK );
- return;
- }
- m_cBB_PMIC_REG_Obj.ConfirmCallback = ::CNF_PMIC_WriteRegister;
- m_cBB_PMIC_REG_Obj.REQ_WriteRegister_Start( m_uiPMICRegAddr, m_usPMICRegValue );
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write PMIC register progressing";
- }
- //-----------------------------------------------
- void TfrmBaseBand::PMIC_WriteRegister_Done(void)
- {
- E_METAAPP_RESULT_T state = m_cBB_PMIC_REG_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write baseband register successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write baseband register fail";
- Application->MessageBox( "Execution Failure : Write Baseband register", "FAILURE", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write baseband register timeout";
- Application->MessageBox( "Execution Timeout : Write Baseband register", "TIMEOUT", MB_OK );
- Force_BB_Stop();
- }
- break;
- case METAAPP_STOP:
- {
- m_sbPMIC->Panels->Items[0]->Text = (AnsiString) " Write baseband register stop";
- }
- break;
- default:
- {
- }
- break;
- }
- }
- void __fastcall TfrmBaseBand::edtPMICAddressCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned int data;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if (! IsValidHexRegAddr(text, data))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_uiPMICRegAddr = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtPMICValueCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned short data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if (DEC_FORMAT == btnPMICRegValue->Tag) // Dec
- {
- if (! IsValidDecRegValue(text, data))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- }
- else // Hex
- {
- if (! IsValidHexRegValue(text, data))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- }
- m_usPMICRegValue = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::btnPMICRegClick(TObject *Sender)
- {
- if ( FT_MT6318 == m_sPmicId.id )
- {
- frmPMICReg->Top = 104;
- frmPMICReg->Left = 135;
- frmPMICReg->Show();
- }
-
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::edtLEDLightLevelCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned char ucdata;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value should be 0~5 ";
- text = edit->Text;
- if( !IsValidLEDLightLevel(text, ucdata))
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sLEDLevel.led_light_level = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::m_edtMainLCDCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned char ucdata;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value should be 0~5 ";
- text = edit->Text;
- if( !IsValidLEDLightLevel(text, ucdata))
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_cMainLCDLevel = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::m_edtSubLCDCheck(TObject *Sender)
- {
- AnsiString text;
- unsigned char ucdata;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value should be 0~5 ";
- text = edit->Text;
- if( !IsValidLEDLightLevel(text, ucdata))
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_cSubLCDLevel = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::m_btnKeypadLEDSetClick(TObject *Sender)
- {
- CurrentPageLock();
- m_cBB_LED_Obj.ConfirmCallback = ::CNF_LED_SetLightLevel;
- m_cBB_LED_Obj.REQ_SetLEDLightLevel_Start(m_sLEDLevel);
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level progressing";
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::CNF_LED_SetLightLevel(void)
- {
- int state = m_cBB_LED_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level fail";
- Application->MessageBox( "Execution Failure : Set LED light level", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level timeout";
- Application->MessageBox( "Execution Timeout : Set LED light level", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmBaseBand::m_btnMainLCDSetClick(TObject *Sender)
- {
- FtLCDLevel sLCDLevel;
- sLCDLevel.lcd_type = GPIO_DEV_LED_MAINLCD;
- sLCDLevel.lcd_light_level = m_edtMainLCD->Text.ToInt();
- CurrentPageLock();
- m_cBB_LED_Obj.ConfirmCallback = ::CNF_LED_MainLCDLightLevel;
- m_cBB_LED_Obj.REQ_SetMainSubLEDLightLevel_Start(sLCDLevel);
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of main LCD progressing";
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::CNF_LED_MainLCDLightLevel(void)
- {
- int state = m_cBB_LED_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of main LCD successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of main LCD fail";
- Application->MessageBox( "Execution Failure : Set LED light level of main LCD", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of main LCD timeout";
- Application->MessageBox( "Execution Timeout : Set LED light level of main LCD", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of main LCD stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmBaseBand::m_btnSubLCDSetClick(TObject *Sender)
- {
- #if 0
- FtLCDLevel sLCDLevel;
- sLCDLevel.lcd_type = GPIO_DEV_LED_SUBLCD;
- sLCDLevel.lcd_light_level = m_edtSubLCD->Text.ToInt();
- CurrentPageLock();
- m_cBB_LED_Obj.ConfirmCallback = ::CNF_LED_SubLCDLightLevel;
- m_cBB_LED_Obj.REQ_SetMainSubLEDLightLevel_Start(sLCDLevel);
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of Sub. LCD progressing";
- #endif
- }
- //---------------------------------------------------------------------------
- void TfrmBaseBand::CNF_LED_SubLCDLightLevel(void)
- {
- int state = m_cBB_LED_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of Sub. LCD successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of Sub. LCD fail";
- Application->MessageBox( "Execution Failure : Set LED light level of Sub. LCD", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of Sub. LCD timeout";
- Application->MessageBox( "Execution Timeout : Set LED light level of Sub. LCD", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Set LED light level of Sub. LCD stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::btnVBROnClick(TObject *Sender)
- {
- FtVibratorOnOff vbr_on_off;
- vbr_on_off.onoff = 1;
- m_cBB_VBR_Obj.ConfirmCallback = ::CNF_VBR_TurnOnVibrator;
- m_cBB_VBR_Obj.REQ_SetVibratorOnOff_Start(vbr_on_off);
- CurrentPageLock();
- m_sbVBR->Panels->Items[0]->Text = (AnsiString) " Turn on vibrator progressing";
- }
- //-------------------------------
- void TfrmBaseBand::CNF_VBR_TurnOnVibrator(void)
- {
- int state = m_cBB_VBR_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbVBR->Panels->Items[0]->Text = (AnsiString) " Turn on vibrator successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbVBR->Panels->Items[0]->Text = (AnsiString) " Turn on vibrator fail";
- Application->MessageBox( "Execution Failure : Turn on vibrator", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbVBR->Panels->Items[0]->Text = (AnsiString) " Turn on vibrator timeout";
- Application->MessageBox( "Execution Timeout : Turn on vibrator", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbVBR->Panels->Items[0]->Text = (AnsiString) " Turn on vibrator stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall TfrmBaseBand::btnVBROffClick(TObject *Sender)
- {
- FtVibratorOnOff vbr_on_off;
- vbr_on_off.onoff = 0;
- m_cBB_VBR_Obj.ConfirmCallback = ::CNF_VBR_TurnOffVibrator;
- m_cBB_VBR_Obj.REQ_SetVibratorOnOff_Start(vbr_on_off);
- CurrentPageLock();
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Turn off vibrator progressing";
- }
- //-------------------------------
- void TfrmBaseBand::CNF_VBR_TurnOffVibrator(void)
- {
- int state = m_cBB_VBR_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Turn off vibrator successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Turn off vibrator fail";
- Application->MessageBox( "Execution Failure : Turn off vibrator", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Turn off vibrator timeout";
- Application->MessageBox( "Execution Timeout : Turn off vibrator", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbLED->Panels->Items[0]->Text = (AnsiString) " Turn off vibrator stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //===========================================================================
- //////////////////////// share information /////////////////////////
- //===========================================================================
- PMIC_ID* TfrmBaseBand::Get_PMIC_ID(void)
- {
- return &m_sPmicId;
- }
- void __fastcall TfrmBaseBand::edtRTCYearCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCMonthCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCDayCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCWDayCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCHourCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCMinuteCheck(TObject *Sender)
- {
- //
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmBaseBand::edtRTCSecCheck(TObject *Sender)
- {
- //
- }
- //===========================================================================
- void __fastcall TfrmBaseBand::btnRTCQueryClick(TObject *Sender)
- {
- m_cBB_RTC_Obj.ConfirmCallback = ::CNF_RTC_Query;
- m_cBB_RTC_Obj.REQ_QueryRTCTime_Start();
- CurrentPageLock();
-
- m_sbRTC->Panels->Items[0]->Text = (AnsiString) " Query RTC time progressing";
- }
- //-------------------------------
- void TfrmBaseBand::CNF_RTC_Query(void)
- {
- int state = m_cBB_RTC_Obj.Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- T_Rtc *p_rtc = m_cBB_RTC_Obj.Get_RTCTime();
- m_sRTC = *p_rtc;
- ReDrawFields(BB_PAGEIDX_RTC);
- m_sbRTC->Panels->Items[0]->Text = (AnsiString) " Query RTC time successful";
- }
- break;
- case METAAPP_FAIL:
- {
- m_sbRTC->Panels->Items[0]->Text = (AnsiString) " Query RTC time fail";
- Application->MessageBox( "Execution Failure : Query RTC time", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- m_sbRTC->Panels->Items[0]->Text = (AnsiString) " Query RTC time timeout";
- Application->MessageBox( "Execution Timeout : Query RTC time", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- m_sbRTC->Panels->Items[0]->Text = (AnsiString) " Query RTC time stop";
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }