browserplugin/cpixnpplugin/src/cmobileinfo.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:32:15 +0300
changeset 2 208a4ba3894c
parent 0 ccd0fd43f247
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/

#include "CMobileInfo.h"

CMobileInfo::CMobileInfo(TDes& aMCC)
	: CActive(CActive::EPriorityStandard),
	iMCC(aMCC),
	iMCCMNCV1Pkg(iMCCMNCV1)
	{
	CActiveScheduler::Add(this);
	}

CMobileInfo::~CMobileInfo()
	{
	Cancel();
	delete iTelephony;
	delete iWait;
	}

void CMobileInfo::GetInfoL(TDes& aMCC)
	{
	CMobileInfo* self= new (ELeave) CMobileInfo(aMCC);
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::PopAndDestroy(self);
	}

void CMobileInfo::ConstructL()
	{
	iWait = new (ELeave) CActiveSchedulerWait();

	iTelephony = CTelephony::NewL();
	iTelephony->GetCurrentNetworkInfo(iStatus, iMCCMNCV1Pkg);
	SetActive();

	iWait->Start();
	}

void CMobileInfo::RunL()
	{
	if(iStatus==KErrNone)
		{
		iMCC = iMCCMNCV1.iCountryCode;
		}
	iWait->AsyncStop();
	}

void CMobileInfo::DoCancel()
	{
	iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
	}

// End of file