×
Namespaces

Variants
Actions

Network name with CTelephony

From Nokia Developer Wiki
Jump to: navigation, search

The CNwNameCheck class illustrates how to read the current network's name using the CTelephony API. Note that this example is intended to be used only with S60 3rd Edition devices, and does not work with pre-3rd Edition devices.

Article Metadata
Code ExampleCompatibilityArticle
Created: symbianyucca (27 Mar 2007)
Last edited: hamishwillee (30 May 2013)

To use this example implement the callback interface function in the implementing class and then construct an instance of the CNwNameCheck. The callback function will be then called with the current networks name.

GetNetWorkName.cpp

CNwNameCheck::~CNwNameCheck()
{
Cancel();
delete iTelephony;
}
 
void CNwNameCheck::ConstructL(void)
{
iTelephony = CTelephony::NewL();
iTelephony->GetCurrentNetworkName(iStatus, iIdV1Pkg);
SetActive();
}
 
CNwNameCheck::CNwNameCheck(MNwNameObserver& aObserver)
: CActive(EPriorityNormal),iObserver(aObserver),iIdV1Pkg(iIdV1)
{
CActiveScheduler::Add(this);
}
 
void CNwNameCheck::RunL()
{
iObserver.NetworkNameL(iIdV1.iNetworkName);
 
}
 
void CNwNameCheck::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkNameCancel);
}


GetNetWorkName.h

#include <Etel3rdParty.h>
 
 
class MNwNameObserver
{
public:
virtual void NetworkNameL(const TDesC& aNwName) = 0;
};
 
 
class CNwNameCheck : public CActive
{
public:
CNwNameCheck(MNwNameObserver& aObserver);
void ConstructL(void);
~CNwNameCheck();
private:
void RunL();
void DoCancel();
private:
MNwNameObserver& iObserver;
CTelephony* iTelephony;
CTelephony::TNetworkNameV1 iIdV1;
CTelephony::TNetworkNameV1Pckg iIdV1Pkg;
};

Download Code Example

This page was last modified on 30 May 2013, at 06:49.
42 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×