imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp
branchRCL_3
changeset 5 82749d516180
child 33 221be23823c5
equal deleted inserted replaced
1:235a7fc86938 5:82749d516180
       
     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     }
       
    49 
       
    50 TBuf<KImeiBufferSize> CTMGetImei::GetIMEI()
       
    51     {    
       
    52     CTelephony::TPhoneIdV1Pckg phoneIdPckg( iV1 );  
       
    53     
       
    54     iTelephony->GetPhoneId( iStatus, phoneIdPckg );
       
    55     SetActive();
       
    56     iAsw.Start();
       
    57     Deque();
       
    58     return iImei;       
       
    59     }
       
    60 
       
    61 void CTMGetImei::DoCancel()
       
    62     {
       
    63     iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
       
    64     }
       
    65    
       
    66 void CTMGetImei::RunL()
       
    67     {
       
    68     if(iStatus == KErrNone)
       
    69         {
       
    70         iImei = iV1.iSerialNumber;
       
    71         }
       
    72     iAsw.AsyncStop();
       
    73     }