Namespaces
Variants
Actions

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

Jump to: navigation, search
Archived.png
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
Tested with
Devices(s): E61i

Compatibility
Platform(s): S60 3rd Edition

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 07:55.
148 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