Namespaces
Variants
Actions

Network name with CTelephony

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 Example
Article
Created: symbianyucca (27 Mar 2007)
Last edited: hamishwillee (12 Jan 2012)

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 12 January 2012, at 06:23.
110 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