Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Find Out Cell ID in 3rd Edition

From Wiki
Jump to: navigation, search

Archived.pngArchived: 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}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Article
Created: feenix (15 Mar 2007)
Last edited: lpvalente (12 Jul 2014)

To find out the phone's current cell ID in Symbian 3rd Edition devices, the application must be Symbian Signed, since it requires the ReadDeviceData capability. The programmer must use an active object because the calls are asynchronous. Below is an example of a class that retrieves the Cell ID by request.

Header Required:

#include<etel3rdparty.h>

Library Required:

LIBRARY etel3rdparty.lib

Capability Required:

Capability ReadDeviceData

NetworkInfo.h

#ifndef __NETWORKINFO_H__
#define __NETWORKINFO_H__
 
#include <etel3rdparty.h> // CTelephony
 
// Observer interface
class MNetworkInfoObserver
{
public:
virtual void NetworkInfoRetrievedL(
const CTelephony::TNetworkInfoV1& aNetworkInfo) = 0;
virtual void HandleNetworkInfoError(TInt aError) = 0;
};
 
// Active object to get network info
class CNetworkInfo : public CActive
{
public:
static CNetworkInfo* NewL();
~CNetworkInfo();
 
void GetNetworkInfoL(MNetworkInfoObserver* aObserver);
 
protected:
// from CActive
void RunL();
TInt RunError(TInt aError);
void DoCancel();
 
private:
CNetworkInfo();
void ConstructL();
 
private:
CTelephony* iTelephony;
CTelephony::TNetworkInfoV1 iNwInfo;
CTelephony::TNetworkInfoV1Pckg iNwInfoPckg;
MNetworkInfoObserver* iObserver;
};
 
#endif // __NETWORKINFO_H__

NetworkInfo.cpp

#include "NetworkInfo.h"
 
CNetworkInfo::CNetworkInfo()
: CActive(EPriorityStandard),
iNwInfoPckg(iNwInfo)
{
CActiveScheduler::Add(this);
}
 
CNetworkInfo* CNetworkInfo::NewL()
{
CNetworkInfo* self = new (ELeave) CNetworkInfo;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}
 
void CNetworkInfo::ConstructL()
{
iTelephony = CTelephony::NewL();
}
 
CNetworkInfo::~CNetworkInfo()
{
Cancel();
delete iTelephony;
}
 
// This function is used by our class' users to start getting network info.
void CNetworkInfo::GetNetworkInfoL(MNetworkInfoObserver* aObserver)
{
__ASSERT_ALWAYS(!IsActive(), User::Leave(KErrInUse));
iObserver = aObserver;
 
// Start async call to receive current network information
iTelephony->GetCurrentNetworkInfo(iStatus, iNwInfoPckg);
SetActive();
}
 
void CNetworkInfo::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
}
 
void CNetworkInfo::RunL()
{
User::LeaveIfError(iStatus.Int());
// Request completed successfully.
// Now we can notify our observer.
if(iObserver)
{
iObserver->NetworkInfoRetrievedL(iNwInfoPckg());
}
}
 
TInt CNetworkInfo::RunError(TInt aError)
{
// There was an error retrieving current network info.
// Let's inform our observer about the error so that it can analyze it
// and try to recover.
if(iObserver)
{
iObserver->HandleNetworkInfoError(aError);
}
 
return KErrNone;
}


Related Links

This page was last modified on 12 July 2014, at 19:15.
93 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.

×