imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tnmgetimei.cc
changeset 0 2014ca87e772
equal deleted inserted replaced
-1:000000000000 0:2014ca87e772
       
     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 "tnmgetimei.h"
       
    20 #include "thumbnailmanagerconstants.h"
       
    21 
       
    22 CTnmgetimei* CTnmgetimei::NewL()
       
    23     {
       
    24     CTnmgetimei *self = CTnmgetimei::NewLC();
       
    25     CleanupStack::Pop();
       
    26     return self;
       
    27     }
       
    28 
       
    29 CTnmgetimei* CTnmgetimei::NewLC()
       
    30     {
       
    31     CTnmgetimei *self = new (ELeave) CTnmgetimei();
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     return self;
       
    35     }
       
    36 
       
    37 void CTnmgetimei::ConstructL()
       
    38    {
       
    39    iTelephony = CTelephony::NewL();
       
    40    CActiveScheduler::Add(this);
       
    41    }
       
    42 
       
    43 CTnmgetimei::~CTnmgetimei()
       
    44     {
       
    45     Cancel();
       
    46 
       
    47     delete iTelephony;
       
    48     }
       
    49 
       
    50 TBuf<KImeiBufferSize> CTnmgetimei::GetIMEI()
       
    51     {   
       
    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 
       
    63 void CTnmgetimei::DoCancel()
       
    64     {
       
    65     iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
       
    66     }
       
    67    
       
    68 void CTnmgetimei::RunL()
       
    69     {
       
    70     if(iStatus == KErrNone)
       
    71         {
       
    72         iImei = iV1.iSerialNumber;
       
    73         }
       
    74     iAsw.AsyncStop();
       
    75     }