imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp
changeset 54 48dd0f169f0d
parent 42 2e2a89493e2b
equal deleted inserted replaced
42:2e2a89493e2b 54:48dd0f169f0d
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Helper class to get IMEI number.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "tmgetimei.h"
       
    20 #include "thumbnailmanagerconstants.h"
       
    21 
       
    22 CTMGetImei* CTMGetImei::NewL()
       
    23     {
       
    24     CTMGetImei *self = CTMGetImei::NewLC();
       
    25     CleanupStack::Pop();
       
    26     return self;
       
    27     }
       
    28 
       
    29 CTMGetImei* CTMGetImei::NewLC()
       
    30     {
       
    31     CTMGetImei *self = new (ELeave) CTMGetImei();
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     return self;
       
    35     }
       
    36 
       
    37 void CTMGetImei::ConstructL()
       
    38    {
       
    39    iTelephony = CTelephony::NewL();
       
    40    CActiveScheduler::Add(this);
       
    41    }
       
    42 
       
    43 CTMGetImei::~CTMGetImei()
       
    44     {
       
    45     Cancel();
       
    46 
       
    47     delete iTelephony;
       
    48     iTelephony = NULL;
       
    49     }
       
    50 
       
    51 TBuf<KImeiBufferSize> CTMGetImei::GetIMEI()
       
    52     {    
       
    53     CTelephony::TPhoneIdV1Pckg phoneIdPckg( iV1 );  
       
    54     
       
    55     iTelephony->GetPhoneId( iStatus, phoneIdPckg );
       
    56     SetActive();
       
    57     iAsw.Start();
       
    58     Deque();
       
    59     return iImei;       
       
    60     }
       
    61 
       
    62 void CTMGetImei::DoCancel()
       
    63     {
       
    64     iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
       
    65     }
       
    66    
       
    67 void CTMGetImei::RunL()
       
    68     {
       
    69     if(iStatus == KErrNone)
       
    70         {
       
    71         iImei = iV1.iSerialNumber;
       
    72         }
       
    73     iAsw.AsyncStop();
       
    74     }