Namespaces
Variants
Actions
(Difference between revisions)

Archived:Get MCC MNC using CTelephony

Jump to: navigation, search
(New page: CTelephonyReader implementation illustrates how to get MCC and MNC in S60 3rd Edition devices with CTelephony API. The implementation is pretty simple, and when using this one only thing ...)
 
Line 1: Line 1:
 +
__NOTOC__
 +
__NOEDITSECTION__
 +
{{CodeSnippet
 +
|id=-
 +
|platform=S60 3rd Edition
 +
|devices= E61i
 +
|category=Symbian C++
 +
|subcategory=
 +
|creationdate=4. May 2009
 +
|keywords=CTelephony::GetCurrentNetworkInfo()
 +
}}
 +
 +
<br>
 +
 +
==Overview==
 
CTelephonyReader implementation illustrates how to get MCC and MNC in S60 3rd Edition devices with CTelephony API.
 
CTelephonyReader implementation illustrates how to get MCC and MNC in S60 3rd Edition devices with CTelephony API.
  

Revision as of 12:21, 5 May 2009


Article Metadata

Tested with
Devices(s): E61i

Compatibility
Platform(s): S60 3rd Edition

Article
Keywords: CTelephony::GetCurrentNetworkInfo()
Created: (04 May 2009)
Last edited: savaj (05 May 2009)


Overview

CTelephonyReader implementation illustrates how to get MCC and MNC in S60 3rd Edition devices with CTelephony API.

The implementation is pretty simple, and when using this one only thing to do in calling class is to implement the callback interface and then to construct an instance of the CTelephonyReader.

Headers Required

#include <Etel3rdParty.h>

Library Needed

LIBRARY   etel3rdparty.lib

Capability Required

Capability  ReadUserData  ReadDeviceData  Location

TelephonyReader.h

#ifndef __TELEPHONYREADER_h__
#define __TELEPHONYREADER_h__
 
#include <Etel3rdParty.h>
class MTelephonyObserver
{
public:
virtual void GetMccMnc(const TDesC& aMcc,const TDesC& aMnc) = 0;
 
};
 
class CTelephonyReader : public CActive
{
 
public:
static CTelephonyReader* NewL(MTelephonyObserver* aObserver);
static CTelephonyReader* NewLC(MTelephonyObserver* aObserver);
void ConstructL(void);
~CTelephonyReader();
protected:
void DoCancel();
void RunL();
 
private:
CTelephonyReader(MTelephonyObserver* aObserver);
 
private:
MTelephonyObserver* iObserver;
CTelephony* iTelephony;
CTelephony::TNetworkInfoV1 iMCCMNCV1;
CTelephony::TNetworkInfoV1Pckg iMCCMNCV1Pkg;
 
};
 
#endif //__TELEPHONYREADER_h__

TelephonyReader.cpp

#include "TelephonyReader.h
 
CTelephonyReader* CTelephonyReader::NewL(MTelephonyObserver* aObserver)
{
CTelephonyReader* self = NewLC(aObserver);
CleanupStack::Pop(self);
return self;
}
 
 
CTelephonyReader* CTelephonyReader::NewLC(MTelephonyObserver* aObserver)
{
CTelephonyReader* self = new (ELeave) CTelephonyReader(aObserver);
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
 
 
CTelephonyReader::CTelephonyReader(MTelephonyObserver* aObserver)
:CActive(0),iObserver(aObserver),iMCCMNCV1Pkg(iMCCMNCV1)
{
}
 
CTelephonyReader::~CTelephonyReader()
{
Cancel();
}
 
void CTelephonyReader::ConstructL(void)
{
CActiveScheduler::Add(this);
 
iTelephony = CTelephony::NewL();
 
iTelephony->GetCurrentNetworkInfo(iStatus,iMCCMNCV1Pkg);
 
SetActive();
}
 
void CTelephonyReader::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
}
 
 
void CTelephonyReader::RunL()
{
if(iStatus == KErrNone)
{
iObserver->GetMccMnc(iMCCMNCV1.iCountryCode,iMCCMNCV1.iNetworkId);
}
}

Example Code

181 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved