Archived:Get Network Name using CTelephony
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Code Example
Source file: Media:MyTelephonyNetworkName.zip
Tested with
Devices(s): E61i
Compatibility
Platform(s): S60 3rd Edition
Platform Security
Capabilities: ReadDeviceData
Article
Keywords: CTelephony::GetCurrentNetworkName()
Created: savaj
(08 May 2009)
Last edited: hamishwillee
(18 Sep 2012)
This article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.
Reasons: hamishwillee (21 Dec 2011)
Needs to be merged with near duplicate article Archived:Get Network Name using CTelephony
Reasons: hamishwillee (21 Dec 2011)
Needs to be merged with near duplicate article Archived:Get Network Name using CTelephony
Contents |
Overview
CTelephonyReader implementation illustrates how to get Network Name in S60 3rd Edition Device 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.
Note: this code will most likely not work in the emulator, thus you should only use it in real devices.
Headers Required
#include <Etel3rdParty.h>Library Needed
LIBRARY etel3rdparty.libCapability Required
Capability ReadDeviceData
TelephonyReader.h
#ifndef __TELEPHONYREADER_h__
#define __TELEPHONYREADER_h__
#include <Etel3rdParty.h>
class MTelephonyObserver
{
public:
virtual void GetCurrentNetworkName(const TDesC& aNetworkName) = 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::TNetworkNameV1 iNetworkNameV1;
CTelephony::TNetworkNameV1Pckg iNetworkNameV1Pckg;
};
#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),iNetworkNameV1Pckg(iNetworkNameV1)
{
}
CTelephonyReader::~CTelephonyReader()
{
Cancel();
delete iTelephony;
}
void CTelephonyReader::ConstructL(void)
{
CActiveScheduler::Add(this);
iTelephony = CTelephony::NewL();
iTelephony->GetCurrentNetworkName(iStatus,iNetworkNameV1Pckg);
SetActive();
}
void CTelephonyReader::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkNameCancel );
}
void CTelephonyReader::RunL()
{
if(iStatus == KErrNone)
{
iObserver->GetCurrentNetworkName(iNetworkNameV1.iNetworkName);
}
}


Why did you create a new article when there already exist such an article?
Please reply as soon as possible otherwise I will delete this article.
Thanks, --kiran10182 21:44, 8 May 2009 (EEST)
I could not found working code example in anyone of them. And i do not want to upload my code example in that articles, because my code example is bit different from that and might create confusion to user.
It does not mean that you should create a new article if there exists already one. Just go ahead and upload your example in that example. The purpose of Wiki is to enhance the existing articles, not to create a new one with some minor details. I will delete your all redundant articles.
Thanks, --kiran10182 09:22, 9 May 2009 (EEST)
Ok i will upload code example there. but is it necessary that code example should match exactly with that of article??
None of the above article gives you network name.
Did you check this article: Network name with CTelephony ? It gives you the network name. Please upload your example in that article and latter on I will delete your this article.
Thanks for your efforts, --kiran10182 21:07, 12 May 2009 (EEST)
Vineet.jain - duplicate article
Hi Hamish,
If i look at this article http://www.developer.nokia.com/Community/Wiki/Network_name_with_CTelephony , it already does the same thing & merging current article with thi one would not be of any use i suppose, so i think deleting this article would be an option i think?...
Thanks
Vineetvineet.jain 15:38, 23 February 2012 (EET)