remotemgmt_plat/syncml_ds_customization_api/tsrc/synchconfigvalidator/customdatasynchdeviceinfo.cpp
branchRCL_3
changeset 25 b183ec05bd8c
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
       
     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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "customdatasynchdeviceinfo.h"
       
    19 
       
    20 #include <Etel3rdParty.h>
       
    21  
       
    22 CDeviceInfo* CDeviceInfo::NewL()
       
    23     {
       
    24     CDeviceInfo* self = NewLC();
       
    25     CleanupStack::Pop( self );
       
    26     return self;
       
    27     }
       
    28     
       
    29 CDeviceInfo* CDeviceInfo::NewLC()
       
    30     {
       
    31     CDeviceInfo* self = new ( ELeave ) CDeviceInfo();
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     return self;
       
    35     }
       
    36 
       
    37 void CDeviceInfo::ConstructL()
       
    38     {   
       
    39     CActiveScheduler::Add( this );
       
    40     iTelephony = CTelephony::NewL();  
       
    41     iWait = new ( ELeave ) CActiveSchedulerWait();
       
    42     }
       
    43     
       
    44 CDeviceInfo::CDeviceInfo()
       
    45 :CActive( EPriorityNormal ), iBatteryInfoV1Pkg( iBatteryInfoV1 ),
       
    46         iPhoneIdV1Pkg( iPhoneIdV1 ),
       
    47         iSignalStrengthV1Pckg( iSignalStrengthV1 ),
       
    48         iSubscriberIdV1Pckg( iSubscriberIdV1 )
       
    49     {
       
    50     }
       
    51  
       
    52 CDeviceInfo::~CDeviceInfo()
       
    53     {
       
    54     Cancel();
       
    55     delete iTelephony;  
       
    56     }
       
    57 
       
    58 TBuf<CTelephony::KPhoneSerialNumberSize> CDeviceInfo::imei()
       
    59     {
       
    60     Cancel();
       
    61     iTelephony->GetPhoneId( iStatus, iPhoneIdV1Pkg );
       
    62     SetActive();
       
    63     
       
    64     if ( !iWait->IsStarted() ) 
       
    65         {
       
    66         iWait->Start();
       
    67         }
       
    68     return iPhoneIdV1.iSerialNumber;
       
    69     }
       
    70 
       
    71 TBuf<CTelephony::KPhoneModelIdSize> CDeviceInfo::model()
       
    72     {
       
    73     Cancel();
       
    74     iTelephony->GetPhoneId( iStatus, iPhoneIdV1Pkg );
       
    75     SetActive();
       
    76     
       
    77     if ( !iWait->IsStarted() ) 
       
    78         {
       
    79         iWait->Start();
       
    80         }
       
    81     return iPhoneIdV1.iModel;
       
    82     }
       
    83 
       
    84 TBuf<CTelephony::KPhoneManufacturerIdSize> CDeviceInfo::manufacturer()
       
    85     {
       
    86     Cancel();
       
    87     iTelephony->GetPhoneId( iStatus, iPhoneIdV1Pkg );
       
    88     SetActive();
       
    89     
       
    90     if ( !iWait->IsStarted() ) 
       
    91         {
       
    92         iWait->Start();
       
    93         }
       
    94     return iPhoneIdV1.iManufacturer;
       
    95     }
       
    96 
       
    97 TBuf<CTelephony::KIMSISize> CDeviceInfo::imsi()
       
    98     {
       
    99     Cancel();
       
   100     iTelephony->GetSubscriberId( iStatus,iSubscriberIdV1Pckg );
       
   101     SetActive();
       
   102     
       
   103     if (!iWait->IsStarted()) 
       
   104         {
       
   105         iWait->Start();
       
   106         }
       
   107     return iSubscriberIdV1.iSubscriberId;
       
   108     }
       
   109 
       
   110 TUint CDeviceInfo::batteryLevel()
       
   111     {
       
   112     Cancel();
       
   113     iTelephony->GetBatteryInfo( iStatus,iBatteryInfoV1Pkg );
       
   114     SetActive();
       
   115     
       
   116     if ( !iWait->IsStarted() ) 
       
   117         {
       
   118         iWait->Start();
       
   119         }
       
   120     return iBatteryInfoV1.iChargeLevel;
       
   121     }
       
   122 
       
   123 TInt32 CDeviceInfo::signalStrength()
       
   124     {
       
   125     Cancel();
       
   126     iTelephony->GetSignalStrength( iStatus, iSignalStrengthV1Pckg );
       
   127     SetActive();
       
   128     if ( !iWait->IsStarted() )
       
   129         {
       
   130         iWait->Start();
       
   131         }
       
   132     return iSignalStrengthV1.iSignalStrength;
       
   133     }
       
   134  
       
   135 void CDeviceInfo::DoCancel()
       
   136     {
       
   137     iTelephony->CancelAsync( CTelephony::EGetPhoneIdCancel );
       
   138     }
       
   139  
       
   140 void CDeviceInfo::RunL()
       
   141     {
       
   142     iWait->AsyncStop();
       
   143     }