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

📄 sysinfo60view4.cpp

📁 基于SYMBIAN OS 的Moblile硬件管理器. 支持series 70平台
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*
* ============================================================================
*  Name     : CSYSINFO60View4 from SYSINFO60View4.h
*  Part of  : SYSINFO60
*  Created  : 13.01.2004 by Petri-Veikko Alaj鋜vi OH1GIU
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: (c) 2004, Petri-Veikko Alaj鋜vi OH1GIU
* ============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include <aknnotewrappers.h>
#include <eikmenup.h>
#include <avkon.hrh>
#include <sysutil.h>
#include <SYSINFO60.rsg>
#include "SYSINFO60.hrh"
#include "SYSINFO60View4.h"
#include "SYSINFO60Container4.h" 
#include "GenFuncs.h"

using namespace NGenFuncs;

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CSYSINFO60View4::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CSYSINFO60View4::ConstructL()
    {
	iLedsOn = EFalse;
    BaseConstructL( R_SYSINFO60_VIEW4 );
	iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
	CalcTimerValues();
	iTelOpen = 0;
    }

// ---------------------------------------------------------
// CSYSINFO60View4::~CSYSINFO60View4()
// ?implementation_description
// ---------------------------------------------------------
//
CSYSINFO60View4::~CSYSINFO60View4()
    {
    if (iPeriodicTimer)
    {
		StopTimer();
    }
    delete iPeriodicTimer;
    iPeriodicTimer = NULL;

	CloseTeL();

	if (iContainer)
    {
        AppUi()->RemoveFromViewStack(*this, iContainer);
    }
    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CSYSINFO60View4::Id()
// ?implementation_description
// ---------------------------------------------------------
//
TUid CSYSINFO60View4::Id() const
    {
    return KView4Id;
    }

// ---------------------------------------------------------
// CSYSINFO60View4::HandleCommandL(TInt aCommand)
// ?implementation_description
// ---------------------------------------------------------
//
void CSYSINFO60View4::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
		case ESYSINFO60CmdV4PhoneInfo:
            {
			TRAPD(err, ShowPhoneInfoL());
			if (err != KErrNone)
			{
				NShowErrorMsgL(_L("Phone info failed\nError "), err);
			}
			break;
			}
		case ESYSINFO60CmdV4PhoneLang:
            {
			PhoneUtils(ESYSINFO60CmdV4PhoneLang);
			break;
			}
		case ESYSINFO60CmdV4PhoneSWver:
            {
			PhoneUtils(ESYSINFO60CmdV4PhoneSWver);
			break;
			}
		case ESYSINFO60CmdV4PhoneBook:
            {
			PhoneUtils(ESYSINFO60CmdV4PhoneBook);
			break;
			}
		case ESYSINFO60CmdV4CNetInfo:
            {
			TRAPD(err, ShowNetInfoL());
			if (err != KErrNone)
			{
				NShowErrorMsgL(_L("Net info failed\nError "), err);
			}
			break;
			}
		case ESYSINFO60CmdV4Net:
            {
			StartTimer(1);
			break;
			}
		case ESYSINFO60CmdV4BattInfo:
			{
			TRAPD(err, ShowBattInfoL());
			if (err != KErrNone)
			{
				NShowErrorMsgL(_L("Battery info failed\nError "), err);
			}
			break;
			}
		case ESYSINFO60CmdV4StartMon:
            {
			CloseTeL();
			TRAPD(err, OpenTeL());
			if (err != KErrNone)
			{
				NShowErrorMsgL(_L("Start mon failed\nError "), err);
			}
			else
			{
				iContainer->iMonitor = 1;
				iSignalSum = iSignalCnt = 0;
				StartTimer();
			}
			break;
			}
		case ESYSINFO60CmdV4StopMon:
            {
			StopTimer();
			CloseTeL();
			iContainer->iMonitor = 0;
			break;
			}
		case ESYSINFO60CmdV4BL:
			{
			(iLedsOn) ? iLedsOn = EFalse : iLedsOn = ETrue;
			break;
			}
		case ESYSINFO60CmdV4SetDelay:
            {
			SetTimerValue(0, iMonitorDelay);
			break;
			}
		case ESYSINFO60CmdV4SetInterval:
            {
			SetTimerValue(1, iMonitorInterval);
			break;
			}
        case EAknSoftkeyBack:
            {
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
            }
        default:
            {
            AppUi()->HandleCommandL(aCommand);
            break;
            }
        }
    }

// ---------------------------------------------------------
// CSYSINFO60View4::HandleClientRectChange()
// ---------------------------------------------------------
//
void CSYSINFO60View4::HandleClientRectChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// ---------------------------------------------------------
// CSYSINFO60View4::DoActivateL(...)
// ?implementation_description
// ---------------------------------------------------------
//
void CSYSINFO60View4::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CSYSINFO60Container4;
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        }
   }

// ---------------------------------------------------------
// CSYSINFO60View4::HandleCommandL(TInt aCommand)
// ?implementation_description
// ---------------------------------------------------------
//
void CSYSINFO60View4::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    iContainer = NULL;
    }

void CSYSINFO60View4::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
	if (aResourceId == R_SYSINFO60_VIEW4_MENU)
	{
		UpdateMenuL(aMenuPane);
	}
}

void CSYSINFO60View4::UpdateMenuL(CEikMenuPane* aMenuPane)
{
	TBool b = EFalse;
	if (!iContainer->iMonitor)
	{
		b = EFalse;
		aMenuPane->SetItemDimmed(ESYSINFO60CmdV4StopMon, ETrue);
	}
	else
	{
		b = ETrue;
		aMenuPane->SetItemDimmed(ESYSINFO60CmdV4StopMon, EFalse);
	}
	for (TInt i = ESYSINFO60CmdV4PhoneSW; i < ESYSINFO60CmdV4StopMon; i++)
	{
		aMenuPane->SetItemDimmed(i, b);
	}
	if (!b)
	{
		if (!iLedsOn)
			aMenuPane->SetItemTextL(ESYSINFO60CmdV4BL, _L("Mon mode: BL off"));
		else
			aMenuPane->SetItemTextL(ESYSINFO60CmdV4BL, _L("Mon mode: BL on"));
	}
}

void CSYSINFO60View4::ShowPhoneInfoL(void)
{
	OpenTeL();

	// Get the phone Info
	RBasicGsmPhone::TId id;
	TInt ret = iPhone.GetGsmPhoneId(id);
	if (ret != KErrNone)
	{
		CloseTeL();
		User::Leave(ret);
	}

	iInfoText.Copy(id.iManufacturerId);
	iInfoText.Append(_L(" "));
	iInfoText.Append(id.iModelId);
	iContainer->PrintLine(iInfoText);

	iInfoText.Copy(_L("REVISION "));
	iInfoText.Append(id.iRevisionId);
	iContainer->PrintLine(iInfoText);

#ifdef __WINS__
	iInfoText.Copy(_L("SERIAL "));
	iInfoText.Append(id.iSerialNumber);
#else
	iContainer->PrintLine(_L("IMEI"));
	iContainer->PrintLine(id.iSerialNumber);
	iInfoText.Copy(_L("TAC "));
	iInfoText.Append(id.iSerialNumber.Left(6));
	iContainer->PrintLine(iInfoText);
	iInfoText.Copy(_L("FAC "));
	iInfoText.Append(id.iSerialNumber.Mid(6, 2));
	iContainer->PrintLine(iInfoText);
	iInfoText.Copy(_L("SERIAL "));
	iInfoText.Append(id.iSerialNumber.Mid(8, 6));
	iContainer->PrintLine(iInfoText);
	iInfoText.Copy(_L("PAD "));
	iInfoText.Append(id.iSerialNumber.Right(1));
#endif
	iContainer->PrintLine(iInfoText);

	CloseTeL();
}

void CSYSINFO60View4::ShowNetInfoL(void)
{
	OpenTeL();

#ifndef __WINS__
	MBasicGsmPhoneNetwork::TCurrentNetworkInfo ni;
	TInt ret = iPhone.GetCurrentNetworkInfo(ni);
	if (ret != KErrNone)
	{
		CloseTeL();
		User::Leave(ret);
	}

	iContainer->PrintLine(ni.iNetworkInfo.iShortName);
	if (ni.iNetworkInfo.iShortName.Length() != ni.iNetworkInfo.iLongName.Length())
		iContainer->PrintLine(ni.iNetworkInfo.iLongName);
	iInfoText.Copy(KCellID);
	iInfoText.AppendNum(ni.iCellId);
	iContainer->PrintLine(iInfoText);
	iInfoText.Copy(KLac);
	iInfoText.AppendNum(ni.iLocationAreaCode);
	iContainer->PrintLine(iInfoText);
	iInfoText.Copy(_L("MCC "));
	iInfoText.AppendNum(ni.iNetworkInfo.iId.iMCC);
	iInfoText.Append(_L("  MNC "));
	iInfoText.AppendNum(ni.iNetworkInfo.iId.iMNC);
	iContainer->PrintLine(iInfoText);

	NetRegStatus();

	TGsmDateTime gdt;
	iInfoText.Format(_L("TIME ZONE %d"), gdt.TimeZone());
	iContainer->PrintLine(iInfoText);
#endif

	CloseTeL();
}

void CSYSINFO60View4::ShowNetsL(void)
{
	OpenTeL();

#ifndef __WINS__
	MBasicGsmPhoneNetwork::TNetworkInfo ni;
	TInt netCnt = 0;
	TInt ret = iPhone.EnumerateDetectedNetworks(netCnt);
	if (ret != KErrNone)
	{
		CloseTeL();
		User::Leave(ret);
	}

	for (TInt i = 0; i < netCnt; i++)
	{
		if ((i * 3) > KGranularityOfArray - 1) break;
		if (iPhone.GetDetectedNetworkInfo(i, ni) == KErrNone)
		{
			iInfoText.Copy(_L(""));
			if (ni.iShortName.Length())
				iInfoText.Copy(ni.iShortName);
			else
			{
				if (ni.iLongName.Length())
					iInfoText.Copy(ni.iLongName);

			}
			iContainer->PrintLine(iInfoText);

			iInfoText.Format(_L("MCC %d  MNC %d"), ni.iId.iMCC, ni.iId.iMNC);
			iContainer->PrintLine(iInfoText);

			switch (ni.iStatus)
			{
			case MBasicGsmPhoneNetwork::ENetStatUnknown:
				{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -