cbsatplugin/atmisccmdplugin/src/telephonywrapper.cpp
branchRCL_3
changeset 72 4b59561a31c0
parent 64 1934667b0e2b
equal deleted inserted replaced
64:1934667b0e2b 72:4b59561a31c0
     1 /*
       
     2  * Copyright (c) 2010 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  * Initial Contributors:
       
     9  * Nokia Corporation - initial contribution.
       
    10  *
       
    11  * Contributors:
       
    12  * Description :
       
    13  *
       
    14  */
       
    15 
       
    16 #include "telephonywrapper.h"
       
    17 #include "debug.h"
       
    18 
       
    19 CTelephonyWrapper* CTelephonyWrapper::NewL()    
       
    20     {
       
    21     TRACE_FUNC_ENTRY
       
    22     CTelephonyWrapper* self = new (ELeave) CTelephonyWrapper();
       
    23     CleanupStack::PushL(self);
       
    24     self->ConstructL();
       
    25     CleanupStack::Pop(self);
       
    26     TRACE_FUNC_EXIT
       
    27     return self;
       
    28     } 
       
    29 
       
    30 CTelephonyWrapper::CTelephonyWrapper() :
       
    31         CActive(CActive::EPriorityStandard), 
       
    32         iPhoneIdV1Pckg(iPhoneIdV1)
       
    33     {
       
    34     TRACE_FUNC_ENTRY
       
    35     TRACE_FUNC_EXIT
       
    36     } 
       
    37     
       
    38 void CTelephonyWrapper::ConstructL()    
       
    39     {
       
    40     TRACE_FUNC_ENTRY
       
    41     CActiveScheduler::Add(this);
       
    42     iTelephony = CTelephony::NewL();
       
    43     TRACE_FUNC_EXIT
       
    44     } 
       
    45     
       
    46 CTelephonyWrapper::~CTelephonyWrapper()    
       
    47     {
       
    48     TRACE_FUNC_ENTRY
       
    49     Cancel();
       
    50     delete iTelephony;
       
    51     TRACE_FUNC_EXIT
       
    52     }    
       
    53     
       
    54 TInt CTelephonyWrapper::SynchronousGetPhoneId()    
       
    55     {
       
    56     TRACE_FUNC_ENTRY
       
    57     
       
    58     if (!IsActive())
       
    59         {
       
    60         iTelephony->GetPhoneId(iStatus, iPhoneIdV1Pckg);
       
    61         SetActive();
       
    62         iWaiter.Start();
       
    63         
       
    64         if (KErrNone == iStatus.Int())
       
    65             {
       
    66             iModel = iPhoneIdV1.iModel.Collapse();
       
    67             iSn = iPhoneIdV1.iSerialNumber.Collapse();
       
    68             iManufacturer = iPhoneIdV1.iManufacturer.Collapse();
       
    69             }
       
    70         }
       
    71     else
       
    72         {
       
    73         TRACE_FUNC_EXIT
       
    74         return KErrInUse;
       
    75         }
       
    76        
       
    77     TRACE_FUNC_EXIT
       
    78     return iStatus.Int();    
       
    79     } 
       
    80 
       
    81 const TDesC8& CTelephonyWrapper::GetPhoneModel()
       
    82     {
       
    83     TRACE_FUNC_ENTRY
       
    84     TRACE_FUNC_EXIT
       
    85     return iModel;
       
    86     }
       
    87 
       
    88 const TDesC8& CTelephonyWrapper::GetPhoneSerialNum()
       
    89     {
       
    90     TRACE_FUNC_ENTRY
       
    91     TRACE_FUNC_EXIT
       
    92     return iSn;
       
    93     }
       
    94 
       
    95 const TDesC8& CTelephonyWrapper::GetPhoneManufacturer()
       
    96     {
       
    97     TRACE_FUNC_ENTRY
       
    98     TRACE_FUNC_EXIT
       
    99     return iManufacturer;
       
   100     }
       
   101 
       
   102 void CTelephonyWrapper::RunL()    
       
   103     {
       
   104     TRACE_FUNC_ENTRY
       
   105     iWaiter.AsyncStop();
       
   106     TRACE_FUNC_EXIT
       
   107     } 
       
   108 
       
   109 void CTelephonyWrapper::DoCancel()    
       
   110     {
       
   111     TRACE_FUNC_ENTRY
       
   112     iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
       
   113     iWaiter.AsyncStop();
       
   114     TRACE_FUNC_EXIT
       
   115     }
       
   116 
       
   117