Como recuperar IMEI no 7710
Dados do artigo
Artigo
Tradução:
Originado de How to get IMEI on 7710
Por ivocalado
Última alteração feita por hamishwillee
em 08 Dec 2011
É possível recuperar informações de IMEI em ambientes S60 2nd edition, usando a API PlpVariant (veja como).
#if !defined(__WINS__) && !defined( __WINSCW__ )
PlpVariant::GetMachineIdL( iImei );
#else
iImei.Copy( KDefaultIMEI );
#endif
No entanto, isto não é possível em dispositivos 7710. Neste caso, para realização de leitura do IMEI é necessário fazer uso do Etel3rdParty.
/* Declare the client class */
class CClientApp : public CActive
{
public:
// Construction
void ConstructL();
// Destruction
~CClientApp();
// Issue request: retrieve IMEI
void GetIMEI();
// Cancel request
void DoCancel();
// Service completed request
void RunL();
private:
CTelephony* iTelephony; // telephony object we own
CTelephony::TPhoneIdV1 iV1;
CTelephony::TPhoneIdV1Pckg* iPkg;
};
/* Define the client class */
void CClientApp::ConstructL()
{
iPkg = new (ELeave) CTelephony::TPhoneIdV1Pckg(iV1);
iTelephony = CTelephony::NewL();
CActiveScheduler::Add(this);
}
CClientApp::~CClientApp()
{
Cancel(); // if any request outstanding, calls DoCancel() to cleanup
delete iTelephony;
delete iPkg;
}
void CClientApp::GetIMEI()
{
iTelephony->GetPhoneId(iStatus,*iPkg );
SetActive();
CActiveScheduler::Start();
}
void CClientApp::RunL()
{
TBuf<50> retrievedIMEI;
if ( (iStatus == KErrNone) )
{
retrievedIMEI = (*iPkg)().iSerialNumber;
}
CActiveScheduler::Stop();
}
void CClientApp::DoCancel()
{
Cancel();
}


(no comments yet)