×
Namespaces

Variants
Actions

Archived:Get Manufacturer and Model number of the device using CTelephony

From Nokia Developer 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}}.

Article Metadata
Code ExampleTested with
Devices(s): E61i
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition (initial release)
Article
Keywords: CTelephony::GetPhoneId()
Created: savaj (08 May 2009)
Last edited: hamishwillee (29 Jun 2012)
Reviewer Approved    Thumbs up icon sm.jpg



Contents

Overview

CTelephonyReader implementation illustrates how to get Manufacturer and Model number of the device in S60 3rd Edition 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 None

TelephonyReader.h

#ifndef __TELEPHONYREADER_h__
#define __TELEPHONYREADER_h__
 
#include <Etel3rdParty.h>
class MTelephonyObserver
{
public:
virtual void GetPhoneId(const TDesC& aManufacturer,const TDesC& aModel) = 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::TPhoneIdV1 iPhoneIdV1;
CTelephony::TPhoneIdV1Pckg iPhoneIdV1Pckg;
};
 
#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),iPhoneIdV1Pckg(iPhoneIdV1)
{
}
 
CTelephonyReader::~CTelephonyReader()
{
Cancel();
delete iTelephony;
}
 
void CTelephonyReader::ConstructL(void)
{
CActiveScheduler::Add(this);
 
iTelephony = CTelephony::NewL();
 
iTelephony->GetPhoneId(iStatus,iPhoneIdV1Pckg);
 
SetActive();
}
 
void CTelephonyReader::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
}
 
 
void CTelephonyReader::RunL()
{
if(iStatus == KErrNone)
{
iObserver->GetPhoneId(iPhoneIdV1.iManufacturer,iPhoneIdV1.iModel);
}
}

Example Code

Related Link

This page was last modified on 29 June 2012, at 04:55.
35 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.

×